apollon.container module

apollon/container.py – Container Classes.

Licensed under the terms of the BSD-3-Clause license. Copyright (C) 2019 Michael Blaß mblass@posteo.net

Classes:

FeatureSpace Params

class apollon.container.FeatureSpace(**kwargs)

Bases: apollon.container.NameSpace

Container class for feature vectors.

as_dict()Dict[str, Any]

Returns the FeatureSpace converted to a dict.

items()List[Tuple[str, Any]]

Provides the the FeatureSpace’s items.

Returns

List of (key, value) pairs.

keys()List[str]

Provides the FeatureSpaces’s keys.

Returns

List of keys.

to_csv(path: Optional[str] = None)None

Write FeatureSpace to csv file.

If path is None, comma separated values are written stdout.

Parameters

path – Output file path.

Returns

FeatureSpace as csv-formatted string if path is None, else None.

to_json(path: Optional[str] = None)Optional[str]

Convert FeaturesSpace to JSON.

If path is None, this method returns of the data of the FeatureSpace in JSON format. Otherwise, data is written to path.

Parameters

path – Output file path.

Returns

FeatureSpace as JSON-formatted string if path is not None, else None.

update(key: str, val: Any)None

Update the set of parameters.

Parameters
  • key – Field name.

  • val – Field value.

values()List[Any]

Provides the FeatureSpace’s values.

Returns

List of values.

class apollon.container.NameSpace(**kwargs)

Bases: object

Simple name space object.

class apollon.container.Params

Bases: object

Parmeter base class.

classmethod from_dict(instance: dict)GenericParams

Construct Params from dictionary

property schema

Returns the serialization schema.

to_dict()dict

Returns parameters as dictionary.

to_json(path: Union[str, pathlib.Path])None

Write parameters to JSON file.

Parameters

path – File path.