jijzepttools.blackbox_optimization.surrogate_model.fmo_surrogate_model#
Classes#
Parameters for Factorization Machine surrogate model. |
|
Factorization Machine surrogate model implementation. |
Module Contents#
- class FMParams#
Bases:
jijzepttools.blackbox_optimization.surrogate_model.interface.SurrogateModelParams
Parameters for Factorization Machine surrogate model.
- latent_dim#
Dimension of latent factors in FM.
- Type:
int, default=5
- n_epochs#
Number of training epochs.
- Type:
int, default=100
- optimizer_params#
Parameters for PyTorch optimizer (e.g., {‘lr’: 0.001, ‘weight_decay’: 1e-4}).
- Type:
dict, default={}
- batch_size#
Batch size for training.
- Type:
int, default=1
- latent_dim: int = 5#
- n_epochs: int = 100#
- optimizer_params: dict#
- batch_size: int = 1#
- class FMSurrogateModel(n_features: int, params: FMParams | None = None)#
Bases:
jijzepttools.blackbox_optimization.surrogate_model.interface.SurrogateModel
Factorization Machine surrogate model implementation.
This model uses second-order feature interactions to approximate the objective function. The mathematical form is: f(x) = w0 + Σ wi*xi + ΣΣ <vi,vj>*xi*xj
- Parameters:
n_features (int) – Number of input features.
params (FMParams, optional) – Parameters for the model. If None, default parameters are used.
- n_features#
- fm_trainer#
- fit(x: numpy.ndarray, y: numpy.ndarray) None #
Fit the Factorization Machine to the data.
- Parameters:
x (np.ndarray, shape (n_samples, n_features)) – Input features.
y (np.ndarray, shape (n_samples,)) – Target values.
- predict(x: numpy.ndarray) numpy.ndarray #
Predict target values using the fitted FM model.
- surrogate_to_ommx_objective(decision_variables: list[ommx.v1.DecisionVariable])#
Create OMMX expression for the fitted FM model.
- Parameters:
decision_variables (list[ommx.v1.DecisionVariable]) – Decision variables from OMMX instance.