lale.lib.sklearn.dummy_classifier module¶
- class lale.lib.sklearn.dummy_classifier.DummyClassifier(*, strategy='prior', random_state=None, constant=None)¶
Bases:
PlannedIndividualOp
Dummy classifier classifier that makes predictions using simple rules.
This documentation is auto-generated from JSON schemas.
- Parameters
strategy (union type, not for optimizer, default 'prior') –
Strategy to use to generate predictions.
’stratified’
Generates predictions by respecting the training set’s class distribution.
or ‘most_frequent’
Always predicts the most frequent label in the training set.
or ‘prior’
Always predicts the class that maximizes the class prior (like ‘most_frequent’) and predict_proba returns the class prior.
or ‘uniform’
Generates predictions uniformly at random.
or ‘constant’, not for optimizer
Always predicts a constant label that is provided by the user. This is useful for metrics that evaluate a non-majority class
See also constraint-1.
random_state (union type, not for optimizer, default None) –
Seed of pseudo-random number generator for shuffling data when solver == ‘sag’, ‘saga’ or ‘liblinear’.
None
RandomState used by np.random
or numpy.random.RandomState
Use the provided random state, only affecting other users of that same random state instance.
or integer
Explicit seed.
constant (union type, optional, not for optimizer, default None) –
The explicit constant as predicted by the “constant” strategy. This parameter is useful only for the “constant” strategy.
string or number or boolean
or None
See also constraint-1.
Notes
constraint-1 : union type
The constant strategy requires a non-None value for the constant hyperparameter.
strategy : negated type of ‘constant’
or constant : negated type of None
- fit(X, y=None, **fit_params)¶
Train the operator.
Note: The fit method is not available until this operator is trainable.
Once this method is available, it will have the following signature:
- Parameters
X (array of items : array of items : Any) – Features; the outer array is over samples.
y (union type) –
Target class labels.
array of items : string
or array of items : float
or array of items : boolean
- predict(X, **predict_params)¶
Make predictions.
Note: The predict method is not available until this operator is trained.
Once this method is available, it will have the following signature:
- Parameters
X (array, optional of items : array of items : Any) – Features; the outer array is over samples.
- Returns
result –
array of items : string
or array of items : float
or array of items : boolean
- Return type
union type
- predict_proba(X)¶
Probability estimates for all classes.
Note: The predict_proba method is not available until this operator is trained.
Once this method is available, it will have the following signature:
- Parameters
X (array of items : array of items : Any) – Features; the outer array is over samples.
- Returns
result
- Return type
array of items : array of items : float