5.1.2. doubleml.utils.DMLDummyClassifier#
- class doubleml.utils.DMLDummyClassifier#
A dummy classifier that raises an AttributeError when attempting to access its fit, predict, set_params, or predict_proba methods.
Methods
fit
()Raises AttributeError: "Accessed fit method of DummyClassifier!"
Get metadata routing of this object.
get_params
([deep])Get parameters for this estimator.
predict
()Raises AttributeError: "Accessed predict method of DummyClassifier!"
predict_proba
(**kwargs)Raises AttributeError: "Accessed predict_proba method of DummyClassifier!"
score
(X, y[, sample_weight])Return the mean accuracy on the given test data and labels.
Raises AttributeError: "Accessed set_params method of DummyClassifier!"
set_score_request
(*[, sample_weight])Request metadata passed to the
score
method.
- DMLDummyClassifier.fit()#
Raises AttributeError: “Accessed fit method of DummyClassifier!”
- DMLDummyClassifier.get_metadata_routing()#
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
routing – A
MetadataRequest
encapsulating routing information.- Return type:
MetadataRequest
- DMLDummyClassifier.get_params(deep=True)#
Get parameters for this estimator.
- DMLDummyClassifier.predict()#
Raises AttributeError: “Accessed predict method of DummyClassifier!”
- DMLDummyClassifier.predict_proba(**kwargs)#
Raises AttributeError: “Accessed predict_proba method of DummyClassifier!”
- DMLDummyClassifier.score(X, y, sample_weight=None)#
Return the mean accuracy on the given test data and labels.
In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.
- Parameters:
X (array-like of shape (n_samples, n_features)) – Test samples.
y (array-like of shape (n_samples,) or (n_samples, n_outputs)) – True labels for X.
sample_weight (array-like of shape (n_samples,), default=None) – Sample weights.
- Returns:
score – Mean accuracy of
self.predict(X)
w.r.t. y.- Return type:
- DMLDummyClassifier.set_params()#
Raises AttributeError: “Accessed set_params method of DummyClassifier!”
- DMLDummyClassifier.set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') DMLDummyClassifier #
Request metadata passed to the
score
method.Note that this method is only relevant if
enable_metadata_routing=True
(seesklearn.set_config()
). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True
: metadata is requested, and passed toscore
if provided. The request is ignored if metadata is not provided.False
: metadata is not requested and the meta-estimator will not pass it toscore
.None
: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str
: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED
) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Note
This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a
Pipeline
. Otherwise it has no effect.