xpdeep_model
Define the xpdeep explainable model.
Classes:
| Name | Description |
|---|---|
XpdeepModel |
Xpdeep Model class. |
Functions:
| Name | Description |
|---|---|
wrapped_from_dict |
Overwrite from_dict method of BuildModelPipelineInputOutput class. |
Attributes:
| Name | Type | Description |
|---|---|---|
DROPOUT_TYPES |
|
|
BATCH_NORM_TYPES |
|
DROPOUT_TYPES = nn.Dropout | nn.Dropout2d | nn.Dropout3d | nn.AlphaDropout | nn.FeatureAlphaDropout
#
BATCH_NORM_TYPES = nn.BatchNorm1d | nn.BatchNorm2d | nn.BatchNorm3d | nn.SyncBatchNorm | nn.LazyBatchNorm1d | nn.LazyBatchNorm2d | nn.LazyBatchNorm3d
#
XpdeepModel
#
Xpdeep Model class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
AbstractModule
|
The feature extraction model, responsible to extract the most important and coherent features prior to the task you want to achieve. |
required |
|
AbstractModule
|
The task learner model is responsible to achieve your task (classification etc.), given a set of meaningful extracted features. |
required |
|
AbstractModule | None
|
The backbone model, having the same role as a traditional backbone model on a neural network, default None. |
None
|
|
ModelDecisionGraphParameters
|
Internal parameters and architecture of the Xpdeep explainable model. |
required |
|
FittedParquetDataset
|
A FittedParquetDataset object containing a fitted schema, required to build the model. This dataset will not be used for training process but only for model definition. |
required |
|
int
|
Seed for reproducibility. |
0
|
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
|
Methods:
| Name | Description |
|---|---|
__attrs_post_init__ |
Post init. |
__setattr__ |
Set attribute. |
from_torch |
Build a Xpdeep model from torch model. |
get_output_size |
Infer the model output size without batch size as it is required to serialize a loss function. |
__repr__ |
Represent the model. |
feature_extraction: AbstractModule
#
task_learner: AbstractModule
#
decision_graph_parameters: ModelDecisionGraphParameters
#
example_dataset: FittedParquetDataset
#
backbone: AbstractModule | None = None
#
seed: int = 0
#
id: str = field(init=False)
#
__attrs_post_init__() -> None
#
Post init.
Source code in src/xpdeep/model/xpdeep_model.py
__setattr__(attr: str, value: object) -> None
#
Set attribute.
Source code in src/xpdeep/model/xpdeep_model.py
from_torch(example_dataset: FittedParquetDataset, feature_extraction: nn.Module, task_learner: nn.Module, decision_graph_parameters: ModelDecisionGraphParameters, backbone: nn.Module | None = None, seed: int = 0) -> Self
#
Build a Xpdeep model from torch model.
Source code in src/xpdeep/model/xpdeep_model.py
get_output_size(schema: FittedSchema) -> tuple[int, ...]
#
Infer the model output size without batch size as it is required to serialize a loss function.
Source code in src/xpdeep/model/xpdeep_model.py
__repr__() -> str
#
Represent the model.
Source code in src/xpdeep/model/xpdeep_model.py
wrapped_from_dict(cls: type[BuildModelPipelineInputOutput], src_dict: Mapping[str, object]) -> BuildModelPipelineInputOutput
#
Overwrite from_dict method of BuildModelPipelineInputOutput class.