Baseline classifier and regressor
fast_automl.baseline.BaselineClassifier
Predicts the most frequent class.
Attributes: | classes_ : array-like of shape (n_classes,)
A list of class weights known to the classifier. counts_ : array-like of shape (n_classes,)Normalized frequency of each class in the training data. dominant_class_ : intClass which appears most frequently in the training data. |
---|
Examples
from fast_automl.baseline import BaselineClassifier
from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
X, y = load_digits(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y)
clf = BaselineClassifier().fit(X_train, y_train)
clf.score(X_test, y_test)
Methods
fit(self, X, y, sample_weight=None) [source]
Fit the model.
Parameters: | X : array-like of shape (n_samples, n_features)
Training data. y : array-like of shape (n_samples,)Target values. sample_weight, array-like of shape (n_samples,), default=Noone :Individual weights for each sample. |
---|---|
Returns: | self :
|
predict(self, X) [source]
Predict class labels for samples in X.
Parameters: | X : array-like of shape (n_samples, n_features)
Samples. |
---|---|
Returns: | C : array of shape (n_samples,)
Predicted class label for each sample. |
predict_proba(self, X) [source]
Probability estimates.
Parameters: | X : array-like of shape (n_samples, n_features)
Samples. |
---|---|
Returns: | T : array-like of shape (n_samples, n_classes)
Probability of the sample for each classes on the model, ordered by |
fast_automl.baseline.BaselineRegressor
Predicts the mean target value.
Attributes: | y_mean_ : np.array
Average target value. |
---|
Examples
from fast_automl.baseline import BaselineRegressor
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
X, y = load_boston(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y)
reg = BaselineRegressor().fit(X_train, y_train)
reg.score(X_test, y_test)
Methods
fit(self, X, y, sample_weight=None) [source]
Parameters: | X : array-like of shape (n_samples, n_features)
Training data. y : array-like of shape (n_samples, n_targets)Target values. sample_weight, array-like of shape (n_samples,), default=Noone :Individual weights for each sample. |
---|---|
Returns: | self :
|
predict(self, X) [source]
Parameters: | X : array-like, shape (n_samples, n_features)
Samples. |
---|---|
Returns: | C : array, shape (n_samples, n_targets)
Predicted values |