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.NameSpaceContainer 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
pathisNone, comma separated values are written stdout.- Parameters
path – Output file path.
- Returns
FeatureSpace as csv-formatted string if
pathisNone, elseNone.
-
to_json(path: Optional[str] = None) → Optional[str]¶ Convert FeaturesSpace to JSON.
If
pathisNone, this method returns of the data of theFeatureSpacein JSON format. Otherwise, data is written topath.- Parameters
path – Output file path.
- Returns
FeatureSpace as JSON-formatted string if path is not
None, elseNone.
-
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:
objectSimple name space object.
-
class
apollon.container.Params¶ Bases:
objectParmeter 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.
-
classmethod