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.
Parameters | estimator: Predictor
Custom estimator. Should implement a name: str or None, default=Nonefit and predict method.
Name for the model. This is the value used to call the
model from atom. The value should start with the model's
acronym: str or None, default=Noneacronym 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).
Model's acronym. If None, it uses the model's needs_scaling: bool, default=Falsename . Specify
this parameter when you want to train multiple custom models
that share the same estimator.
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 has_validation: str or None, default=Nonemultioutput meta-estimator.
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.
|
Returns | estimator
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 ~