Skip to content

ATOMModel


function atom.api.ATOMModel(estimator, name=None, acronym=None, needs_scaling=False, native_multioutput=False, has_validation=None)[source]
Convert an estimator to a model that can be ingested by atom.

This function adds the relevant attributes to the estimator so that they can be used by atom. Note that only estimators that follow sklearn's API are compatible.

Read more about using custom models in the user guide.

Parametersestimator: Predictor
Custom estimator. Should implement a fit and predict method.

name: str or None, default=None
Name for the model. This is the value used to call the model from atom. The value should start with the model's acronym when specified. If None, the capital letters of the estimator's name are used (only if two or more, else it uses the entire name).

acronym: str or None, default=None
Model's acronym. If None, it uses the model's name. Specify this parameter when you want to train multiple custom models that share the same estimator.

needs_scaling: bool, default=False
Whether the model should use automated feature scaling.

native_multioutput: bool, default=False
Whether the model has native support for multioutput tasks. If True, the model won't use the multioutput meta-estimator.

has_validation: str or None, default=None
Whether the model allows in-training validation. If str, name of the estimator's parameter that states the number of iterations. If None, no support for in-training validation.

Returnsestimator
Clone of the provided estimator with custom attributes.

Example

>>> from atom import ATOMRegressor, ATOMModel
>>> from sklearn.linear_model import RANSACRegressor

>>> ransac =  ATOMModel(
...      estimator=RANSACRegressor(),
...      name="RANSAC",
...      needs_scaling=False,
...  )

>>> atom = ATOMRegressor(X, y)
>>> atom.run(ransac, verbose=2)

Training ========================= >>
Models: RANSAC
Metric: r2


Results for RANSACRegressor:
Fit ---------------------------------------------
Train evaluation --> r2: -2.1784
Test evaluation --> r2: -9.4592
Time elapsed: 0.072s
-------------------------------------------------
Total time: 0.072s


Final results ==================== >>
Total time: 0.072s
-------------------------------------
RANSACRegressor --> r2: -9.4592 ~