sampo.api.RunConfiguration

class sampo.api.RunConfiguration(name, ptype, ds_params, model_proc_name=None, hotstart_infos=None)

RunConfiguration is an object that describes a run configuration of a learning/prediction process.

Parameters
namestr

Name of the process. The first character must be an alphabetic character.

ptypeProcessType or {‘learn’, ‘predict’}

Process type: learning (ProcessType.LEARN or ‘learn’) or prediction (ProcessType.PREDICT or ‘predict’).

ds_paramsdict

The key is cid (component ID) str and the value is a DataSource parameters dict. Valid key and values are same as Parameters specific to each data source in SRC (SAMPO Run Configuration) File specification.

model_proc_namestr or None

The run configuration doesn’t require an SPD file path when the process type (ptype) is “predict”, because the prediction process refers to the process description of the model process corresponding to model_proc_name.

hotstart_infodict or None

The hotstart information.

Raises
ValidationError
  • If name is neither str nor ‘’.

  • If data_sources is not valid dict.

  • If ptype is not any of ProcessType, ‘learn’ and ‘predict’.

  • If model_proc_name is not None for the learning process, or is not str for the prediction process.

Examples

>>> import pandas as pd
>>> from sampo.api import RunConfiguration
>>> from sampotools.api import gen_asd_from_pandas_df
>>> learn_df = pd.read_csv('data/fabhmerg_learn.csv')
>>> asd = gen_asd_from_pandas_df(learn_df)
>>> learn_rc = RunConfiguration(name='fabhmerg_learn', ptype='learn',
...                             ds_params={'dl1': {df: learn_df, attr_schema: asd,
...                                                filters: [slice(5, 100, 2)]}})
property name
Returns
namestr

Process name.

property ptype
Returns
ptype{ProcessType.LEARN, ProcessType.PREDICT}
property ds_params
Returns
ds_paramsdict

The key is cid (component ID) str and the value is a DataSource parameters dict.

property model_proc_name
Returns
model_proc_namestr

Model process name.

property hotstart_infos
Returns
hotstart_infosdict

Hotstart informations.