Data Base Clasess#
The dataset representations as well as the evaluation results are based on common base classes.
RelationBase
#
RelationBase(
relation_code: str,
*,
lazy_options: Optional[dict[str, Any]] = None,
instance_table: Optional[DataFrame] = None,
answer_space: Optional[Series] = None,
relation_info: Optional[dict[str, Any]] = None
)
Base class for the representation of relations and relations results.
Methods:
Name | Description |
---|---|
activated |
Return self or a copy of self with the instance_table loaded (lazy loading disabled). |
copy |
Create a copy of the isntance with specified fields replaced by new values. |
from_path |
Load data from the given path. |
get_metadata |
Get or set metadata. |
relation_info |
Get or set additional relation information. |
save |
Save results to a file and export meta_data |
save_instance_table |
Save instance table with the format determined by the path suffix. |
search_path |
Search path for instance files. |
Attributes:
Name | Type | Description |
---|---|---|
answer_space |
Series
|
The answer space of the relation. |
instance_table |
DataFrame
|
A |
relation_code |
str
|
The identifier of the relation. |
instance_table
property
#
instance_table: DataFrame
A pandas.DataFrame
containing all items in the relation.
activated
#
Return self or a copy of self with the instance_table loaded (lazy loading disabled).
from_path
abstractmethod
classmethod
#
Load data from the given path.
If lazy
, only the metadata is loaded and the instances are loaded once they are accessed.
get_metadata
#
get_metadata(key: str) -> Any
get_metadata(
key: Optional[str] = None,
) -> Union[Any, dict[str, Any]]
Get or set metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Optional[str]
|
The metadata to retrieve. If not field is specified, the complete dictionary is returned. |
None
|
Returns:
Type | Description |
---|---|
Union[Any, dict[str, Any]]
|
Either the selected field or the complete dictionary. |
relation_info
#
Get or set additional relation information.
Use relation.relation_info(<field name>=<new value>)
to set fields in the relation info dictionary.
If a single field is selected, the respective value is returned. Otherwise the complete dictionary is
returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Optional[str]
|
The field to retrieve. |
None
|
|
The fields not modify. |
{}
|
Returns:
Type | Description |
---|---|
Union[None, Any, dict[str, Any]]
|
If a field is selected, the respective value is returned, otherwise, the complete info dictionary is |
Union[None, Any, dict[str, Any]]
|
returned. |
save
#
Save results to a file and export meta_data
save_instance_table
classmethod
#
save_instance_table(
instance_table: DataFrame,
path: Path,
fmt: InstanceTableFileFormat = None,
)
Save instance table with the format determined by the path suffix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
DataFrame
|
The instances to save. |
required |
|
Path
|
Where to save the instance table. If format is not specified, the suffix is used to determined the format. |
required |
|
str
|
Which to save the instances in. |
None
|
search_path
classmethod
#
search_path(
path: Path,
relation_code: Optional[str] = None,
fmt: InstanceTableFileFormat = None,
) -> Union[list[Path], Path, None]
Search path for instance files.
DatasetBase
#
Base class for a collection of relations or relations results.
Methods:
Name | Description |
---|---|
activated |
Return self if lazy loading is active, otherwise return a copy without lazy loading. |
from_path |
Load data from the given path. |