Regressors#

Base Regressor#

class udao.model.regressors.base_regressor.BaseRegressor(net_params: Params)#

Bases: Module, ABC

class Params(input_embedding_dim: int, input_features_dim: int, output_dim: int)#

Bases: object

input_embedding_dim: int#

Size of the embedding part of the input.

input_features_dim: int#

Size of the tabular features.

output_dim: int#

Size of the output tensor.

abstract forward(embedding: Tensor, inst_feat: Tensor) Tensor#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

MLP Regressor#

class udao.model.regressors.mlp.MLP(net_params: Params)#

Bases: BaseRegressor

MLP to compute the final regression from the embedding and the tabular input features. :param net_params: For the parameters, see the MLP.Params dataclass. :type net_params: MLP.Params

class Params(input_embedding_dim: int, input_features_dim: int, output_dim: int, n_layers: int, hidden_dim: int, dropout: float, agg_dims: List[int] | None = None)#

Bases: Params

agg_dims: List[int] | None = None#

Dimensions of the aggregation layers in the MLP.

dropout: float#

Probability of dropout.

hidden_dim: int#

Size of the hidden layers outputs.

n_layers: int#

Number of layers in the MLP

forward(embedding: Tensor, inst_feat: Tensor) Tensor#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.