API CheatSheet¶
Full API Reference: (https://pycombo.readthedocs.io/en/latest/api.html). The following APIs are consistent for most of the models (API Cheatsheet: https://pycombo.readthedocs.io/en/latest/api_cc.html).
combo.models.base.BaseAggregator.fit()
: Fit estimator. y is optional for unsupervised methods.combo.models.base.BaseAggregator.predict()
: Predict on a particular sample once the estimator is fitted.combo.models.base.BaseAggregator.predict_proba()
: Predict the probability of a sample belonging to each class once the estimator is fitted.combo.models.base.BaseAggregator.fit_predict()
: Fit estimator and predict on X. y is optional for unsupervised methods.
Helpful functions:
combo.models.base.BaseAggregator.get_params()
: Get the parameters of the model.combo.models.base.BaseAggregator.set_params()
: Set the parameters of the model.Each base estimator can be accessed by calling clf[i] where i is the estimator index.
For raw score combination (after the score matrix is generated), use individual methods from “score_comb.py” directly. Raw score combination API: (https://pycombo.readthedocs.io/en/latest/api.html#score-combination).
See base class definition below:
combo.models.base module¶
Base class for core models
-
class
combo.models.base.
BaseAggregator
(base_estimators, pre_fitted=False)[source]¶ Bases:
abc.ABC
Abstract class for all combination classes.
- Parameters
-
abstract
fit
(X, y=None)[source]¶ Fit estimator. y is optional for unsupervised methods.
- Parameters
X (numpy array of shape (n_samples, n_features)) – The input samples.
y (numpy array of shape (n_samples,), optional (default=None)) – The ground truth of the input samples (labels).
- Returns
- Return type
self
-
abstract
fit_predict
(X, y=None)[source]¶ Fit estimator and predict on X. y is optional for unsupervised methods.
- Parameters
X (numpy array of shape (n_samples, n_features)) – The input samples.
y (numpy array of shape (n_samples,), optional (default=None)) – The ground truth of the input samples (labels).
- Returns
labels – Class labels for each data sample.
- Return type
numpy array of shape (n_samples,)
-
get_params
(deep=True)[source]¶ Get parameters for this estimator.
See http://scikit-learn.org/stable/modules/generated/sklearn.base.BaseEstimator.html and sklearn/base.py for more information.
- Parameters
deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Returns
params – Parameter names mapped to their values.
- Return type
mapping of string to any
-
abstract
predict
(X)[source]¶ Predict the class labels for the provided data.
- Parameters
X (numpy array of shape (n_samples, n_features)) – The input samples.
- Returns
labels – Class labels for each data sample.
- Return type
numpy array of shape (n_samples,)
-
abstract
predict_proba
(X)[source]¶ Return probability estimates for the test data X.
- Parameters
X (numpy array of shape (n_samples, n_features)) – The input samples.
- Returns
p – The class probabilities of the input samples. Classes are ordered by lexicographic order.
- Return type
numpy array of shape (n_samples,)
-
set_params
(**params)[source]¶ Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.See http://scikit-learn.org/stable/modules/generated/sklearn.base.BaseEstimator.html and sklearn/base.py for more information.
- Returns
self
- Return type