Concept

class hybrid_learning.concepts.concepts.Concept(name, data)[source]

Bases: object

Representation of a concept with data and meta information. Sub-classes should implement the property type and extend the data checks in _validate_dataset(). Different general types can be found in ConceptTypes.

Public Data Attributes:

type

The type of the concept including according type checks.

train_data

Training data set.

val_data

Validation data set.

test_data

Test data set.

train_val_data

Combined dataset of the defining training and validation data.

settings

Settings dict to reproduce instance.

Special Methods:

__init__(name, data)

Init.

__eq__(other)

Equality check by checking on values.

__repr__()

Nice printing function.


Parameters
__eq__(other)[source]

Equality check by checking on values. Especially, datasets must be the same objects.

__init__(name, data)[source]

Init.

Parameters
  • name (str) – name and ID of the concept (should be descriptive and unique)

  • data (DataTriple) – dataset splits of data representing the concept

__repr__()[source]

Nice printing function.

Return type

str

static _validate_dataset(data, data_desc='??')[source]

Check whether the given data fulfills all required properties and raise if not. Extend in sub-class.

Parameters
  • data (torch.utils.data.Dataset) – dataset to validate

  • data_desc (str) – some description of the data for more informative error messages

Raises

ValueError

Returns

the unchanged given dataset

Return type

torch.utils.data.Dataset

classmethod new(concept)[source]

Initialize a concept from the attributes of another by references. This is helpful when converting concepts to specific sub-classes (with the corresponding data checks during init).

Parameters

concept (Concept) –

__hash__ = None
data: DataTriple

The data defining the concept, split into train/val/test data.

name: str

The name, or ID, of the concept. Should be descriptive.

property settings: Dict[str, Any]

Settings dict to reproduce instance. Use as keyword args for init.

property test_data: torch.utils.data.Dataset

Test data set. See test attribute of data.

property train_data: torch.utils.data.Dataset

Training data set. See train attribute of data.

property train_val_data: torch.utils.data.Dataset

Combined dataset of the defining training and validation data. See train_val attribute of data.

property type: ConceptTypes

The type of the concept including according type checks.

property val_data: torch.utils.data.Dataset

Validation data set. See val attribute of data.