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).

Helpful functions:

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
  • base_estimators (list, length must be greater than 1) – A list of base estimators. Certain methods must be present, e.g., fit and predict.

  • pre_fitted (bool, optional (default=False)) – Whether the base estimators are trained. If True, fit process may be skipped.

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

object