=================
sampo_ps proc2spd
=================

.. contents:: Contents
    :local:

Overview
========

.. warning::

   sampo_ps proc2spd command is deprecated.

**sampo_ps proc2spd** converts a learned process into SPD file.
When a process has Feature Learner, it is converted to Feature Descriptor.
Output attributes which were not used for the successor are removed.
Components without output attributes are removed from Process.

|

Synopsis
========
See sampo_ps command help::

    $ sampo_ps proc2spd --help

|

Examples
========

* Learn using apd.spd

  * Command::

      $ sampo learn fl.spd -s ps

    ps is ProcessStore.

  * apd.spd::

     dl -> hr  -> fs
        -> bin -> fs
        -> ts  -> fs

     ---

     components:
         dl:
             component: DataLoader

         hr:
             component: HingeRampFLComponent
             features: scale == 'real' or scale == 'integer'
             max_num_output_features: 15

         bin:
             component: BinarizeFLComponent
             features: scale == 'real' or scale == 'integer'
             max_num_output_features: 10

         ts:
             component: TimeshiftFDComponent
             features: scale == 'real' or scale == 'integer'
             shift: [["all()", [2,10]]]

         fs:
             component: LinearHSICFSComponent
             features: scale == 'real' or scale == 'integer'
             target: name == 'target_value'
             max_num_output_features: 5

     global_settings:
         keep_attributes:
             - target_value
         feature_exclude:
             - target_value

|

* Output SPD file

  * Command::

      $ sampo_ps proc2spd -s ps -p my_process -o ./

    my_process is process name.

  * apd_my_process.spd::

      dl -> bin -> fs
      dl -> ts  -> fs

      ---

      components:
          dl:
              component: DataLoader

          ts:
              component: TimeshiftFDComponent
              features: scale == 'real' or scale == 'integer'
              shift:
              - [name =="attr2", [2]]
              - [name =="attr4", [2]]

          bin:
              component: BinarizeFDComponent
              features: scale == 'real' or scale == 'integer'
              binarize_param:
              - [name =="attr2", [{threshold: 3.5}]]

          fs:
              component: DummyFDComponent
              features: name == 'bin(3.5)_attr2' or name == 'ts(2)_attr2' or name == 'ts(2)_attr4'


      global_settings:
          keep_attributes:
          - target_value

          feature_exclude:
          - target_value

    * BinarizeFLComponent converted to BinarizeFDComponent. LinearHSICFSComponent converted to DummyFDComponent.
    * TimeshiftFDComponent output attributes which were not used for the successor are removed.(BinarizeFLComponent and HingeRampFLCmponent output attributes were deleted similarly.)
    * HingeRampFLCmponent removed from Process.(Output attributes of HingeRampFLCmponent were not selected by Feature Selection)

|

Output Format
=============

Output SPD file name is <original SPD file name>_<process name>.spd .

.. seealso::

    SPD file format in `SPD (SAMPO Process Description) File Specification <../../../input/spd.html>`_
