base_model
Base model implementation for all MLTE models.
BaseModel
Bases: BaseModel
The base model for all MLTE models.
Source code in mlte/model/base_model.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
__eq__(other)
Test instance for equality.
Source code in mlte/model/base_model.py
63 64 65 66 67 | |
from_json(data)
classmethod
Deserialize a model from data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dict[str, Any]
|
The raw input data |
required |
Returns:
| Type | Description |
|---|---|
BaseModel
|
A deserialized model instance |
Source code in mlte/model/base_model.py
31 32 33 34 35 36 37 38 | |
from_json_string(json_str)
classmethod
Deserialize from a json string.
Source code in mlte/model/base_model.py
44 45 46 47 | |
post_validation_hook(data=None)
Called after validation, lets submodels do any needed post-processing.
Source code in mlte/model/base_model.py
49 50 51 | |
to_json()
Serialize the model. Also check if the result is serializable.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The JSON representation of the model |
Source code in mlte/model/base_model.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
to_json_string()
Serialize to a json string.
Source code in mlte/model/base_model.py
40 41 42 | |