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 ModelDecisionGraphParametersRequestBody 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 |
|
int
|
Seed for reproducibility. |
0
|
Methods:
| Name | Description |
|---|---|
from_torch |
Build a Xpdeep model from torch model. |
to_model |
As request body. |
get_output_size |
Infer the model output size without batch size as it is required to serialize a loss function. |
__repr__ |
Represent the model. |
Attributes:
| Name | Type | Description |
|---|---|---|
feature_extraction |
AbstractModule
|
|
task_learner |
AbstractModule
|
|
decision_graph_parameters |
ModelDecisionGraphParameters
|
|
backbone |
AbstractModule | None
|
|
seed |
int
|
|
feature_extraction: AbstractModule
#
task_learner: AbstractModule
#
decision_graph_parameters: ModelDecisionGraphParameters
#
backbone: AbstractModule | None = None
#
seed: int = 0
#
from_torch(fitted_schema: FittedSchema, 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
to_model() -> XpdeepModelRequestBody
#
As request body.
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[ModelDecisionGraphParametersRequestBody], src_dict: Mapping[str, object]) -> ModelDecisionGraphParametersRequestBody
#
Overwrite from_dict method of ModelDecisionGraphParametersRequestBody class.
Bug in the current generated client: it tries if graph depth is not an integer it raises an Exception.