multimodal.kernels package

Submodules

multimodal.kernels.lpMKL module

class multimodal.kernels.lpMKL.MKL(lmbda, nystrom_param=1.0, kernel='linear', kernel_params=None, use_approx=True, precision=0.0001, n_loops=50)

Bases: BaseEstimator, ClassifierMixin, MKernel

MKL Classifier for multiview learning

Parameters:
lmbdafloat coeficient for combined kernels
nystrom_paramfloat (default1.0)

value between 0 and 1 indicating level of nyström approximation; 1 = no approximation

kernellist of str (default: “precomputed”) if kernel is as input of fit function set kernel to

“precomputed” list or str indicate the metrics used for each kernels list of pairwise kernel function name (default : “precomputed”) if kernel is as input of fit function set kernel to “precomputed” example : [‘rbf’, ‘additive_chi2’, ‘linear’ ] for function defined in as PAIRWISE_KERNEL_FUNCTIONS

kernel_paramslist of str defaultNone) list of dictionaries for parameters of kernel [{‘gamma’:50}

list of dict of corresponding kernels params KERNEL_PARAMS

use_approx(defaultTrue) to use approximation of m_param < 1
n_loops(default 50) number of iterions
Attributes:
lmbdafloat coeficient for combined kernels
m_paramfloat (default1.0)

value between 0 and 1 indicating level of nyström approximation; 1 = no approximation

kernellist or str indicate the metrics used for each kernels

list of pairwise kernel function name (default : “precomputed”) example : [‘rbf’, ‘additive_chi2’, ‘linear’ ] for function defined in as PAIRWISE_KERNEL_FUNCTIONS example kernel=[‘rbf’, ‘rbf’], for the first two views

kernel_params: list of dict of corresponding kernels params KERNEL_PARAMS
precisionfloat (default1E-4) precision to stop algorithm
n_loopsnumber of iterions
classes_array like unique label for classes
X_metriclearning.datasets.data_sample.Metriclearn_array array of input sample
K_metriclearning.datasets.data_sample.Metriclearn_array array of processed kernels
y_array-like, shape = (n_samples,)

Target values (class labels).

Clearning solution that is learned in MKL
weightslearned weight for combining the solutions of views, learned in
decision_function(X)

Compute the decision function of X.

Parameters:
Xdict dictionary with all views {array like} with shape = (n_samples, n_features) for multi-view

for each view. or MultiModalData , MultiModalArray or {array-like,}, shape = (n_samples, n_features) Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

Returns:
dec_funnumpy.ndarray, shape = (n_samples, )

Decision function of the input samples. For binary classification, values <=0 mean classification in the first class in classes_ and values >0 mean classification in the second class in classes_.

fit(X, y=None, views_ind=None)
Parameters:
Xdifferent formats are supported
  • Metriclearn_array {array-like, sparse matrix}, shape = (n_samples, n_features) Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

  • Dictionary of {array like} with shape = (n_samples, n_features) for multi-view for each view.

  • Array of {array like} with shape = (n_samples, n_features) for multi-view for each view.

  • {array like} with (n_samples, nviews * n_features) with ‘views_ind’ diferent to ‘None’

yarray-like, shape = (n_samples,)

Target values (class labels). array of length n_samples containing the classification/regression labels for training data

views_indarray-like (default=[0, n_features//2, n_features])

Paramater specifying how to extract the data views from X:

  • views_ind is a 1-D array of sorted integers, the entries indicate the limits of the slices used to extract the views, where view n is given by X[:, views_ind[n]:views_ind[n+1]].

    With this convention each view is therefore a view (in the NumPy sense) of X and no copy of the data is done.

Returns:
selfobject

Returns self.

learn_lpMKL()

function of lpMKL learning

Returns:
return tuple (C, weights)
lpMKL_predict(X, C, weights)
Parameters:
Xarray-like test kernels precomputed array like
Ccorresponding to Confusion learned matrix
weightslearned weights
Returns:
ynumpy.ndarray, shape = (n_samples,)

Predicted classes.

predict(X)
Parameters:
Xdict dictionary with all views {array like} with shape = (n_samples, n_features) for multi-view

for each view. or MultiModalData , MultiModalArray or {array-like,}, shape = (n_samples, n_features) Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

views_indarray-like (default=[0, n_features//2, n_features])

Paramater specifying how to extract the data views from X:

  • views_ind is a 1-D array of sorted integers, the entries indicate the limits of the slices used to extract the views, where view n is given by X[:, views_ind[n]:views_ind[n+1]].

    With this convention each view is therefore a view (in the NumPy sense) of X and no copy of the data is done.

Returns:
ynumpy.ndarray, shape = (n_samples,)

Predicted classes.

score(X, y)

Return the mean accuracy on the given test data and labels.

Parameters:
Xdict dictionary with all views {array like} with shape = (n_samples, n_features) for multi-view

for each view. or MultiModalData , MultiModalArray or {array-like,}, shape = (n_samples, n_features) Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

yarray-like, shape = (n_samples,)

True labels for X.

Returns:
scorefloat

Mean accuracy of self.predict(X) wrt. y.

set_fit_request(*, views_ind: Union[bool, None, str] = '$UNCHANGED$') MKL

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

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

New in version 1.3.

Parameters:
views_indstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for views_ind parameter in fit.

Returns:
selfobject

The updated object.

multimodal.kernels.mkernel module

class multimodal.kernels.mkernel.MKernel

Bases: object

Abstract class MKL and MVML should inherit from for methods of transform kernel to/from data.

Attributes:
W_sqrootinv_dictdict of nyström approximation kernel

in the case of nystrom approximation the a dictonary of reduced kernel is calculated

kernel_paramslist of dict of corresponding kernels

params KERNEL_PARAMS

multimodal.kernels.mvml module

class multimodal.kernels.mvml.MVML(lmbda=0.1, eta=1, nystrom_param=1.0, kernel='linear', kernel_params=None, learn_A=1, learn_w=0, precision=0.0001, n_loops=6)

Bases: MKernel, BaseEstimator, ClassifierMixin, RegressorMixin

The MVML Classifier

Parameters:
lmbdafloat regression_params lmbda (default = 0.1) for basic regularization
etafloat regression_params eta (default = 1), first for basic regularization,

regularization of A (not necessary if A is not learned)

kernellist of str (default: “precomputed”) if kernel is as input of fit function set kernel to

“precomputed” list or str indicate the metrics used for each kernels list of pairwise kernel function name (default : “precomputed”) if kernel is as input of fit function set kernel to “precomputed” example : [‘rbf’, ‘additive_chi2’, ‘linear’ ] for function defined in as PAIRWISE_KERNEL_FUNCTIONS

kernel_paramslist of str defaultNone) list of dictionaries for parameters of kernel [{‘gamma’:50}

list of dict of corresponding kernels params KERNEL_PARAMS

nystrom_param: value between 0 and 1 indicating level of nyström approximation; 1 = no approximation
learn_Ainteger (default 1) choose if A is learned or not: 1 - yes (default);

2 - yes, sparse; 3 - no (MVML_Cov); 4 - no (MVML_I)

learn_winteger (default 0) where learn w is needed
precisionfloat (default1E-4) precision to stop algorithm
n_loops(default 6) number of iterions

Examples

>>> from multimodal.kernels.mvml import MVML
>>> from sklearn.datasets import load_iris
>>> X, y = load_iris(return_X_y=True)
>>> y[y>0] = 1
>>> views_ind = [0, 2, 4]  # view 0: sepal data, view 1: petal data
>>> clf = MVML()
>>> clf.get_params()
{'eta': 1, 'kernel': 'linear', 'kernel_params': None, 'learn_A': 1, 'learn_w': 0, 'lmbda': 0.1, 'n_loops': 6, 'nystrom_param': 1.0, 'precision': 0.0001}
>>> clf.fit(X, y, views_ind)  
MVML()
>>> print(clf.predict([[ 5.,  3.,  1.,  1.]]))
0
Attributes:
lmbdafloat regression_params lmbda (default = 0.1)
etafloat regression_params eta (default = 1)
regression_paramsarray/list of regression parameters
kernellist or str indicate the metrics used for each kernels

list of pairwise kernel function name (default : “precomputed”) example : [‘rbf’, ‘additive_chi2’, ‘linear’ ] for function defined in as PAIRWISE_KERNEL_FUNCTIONS example kernel=[‘rbf’, ‘rbf’], for the first two views

kernel_params: list of dict of corresponding kernels params KERNEL_PARAMS
learn_A1 where Learn matrix A is needded
learn_winteger where learn w is needed
precisionfloat (default1E-4) precision to stop algorithm
n_loopsnumber of itterions
n_approxnumber of samples in approximation, equals n if no approx.
classes_array like unique label for classes
warning_messagedictionary with warning messages
X_metriclearning.datasets.data_sample.Metriclearn_array array of input sample
K_metriclearning.datasets.data_sample.Metriclearn_array array of processed kernels
y_array-like, shape = (n_samples,)

Target values (class labels).

regression_if the classifier is used as regression (defaultFalse)
decision_function(X)

Compute the decision function of X.

Parameters:
X{ array-like, sparse matrix},

shape = (n_samples, n_views * n_features) Multi-view input samples. maybe also MultimodalData

Returns:
dec_funnumpy.ndarray, shape = (n_samples, )

Decision function of the input samples. For binary classification, values <=0 mean classification in the first class in classes_ and values >0 mean classification in the second class in classes_.

fit(X, y=None, views_ind=None)

Fit the MVML classifier

Parameters:
X- Metriclearn_array {array-like, sparse matrix}, shape = (n_samples, n_features)

Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

or - Dictionary of {array like} with shape = (n_samples, n_features) for multi-view

for each view.

  • Array of {array like} with shape = (n_samples, n_features) for multi-view for each view.

  • {array like} with (n_samples, nviews * n_features) with ‘views_ind’ diferent to ‘None’

yarray-like, shape = (n_samples,)

Target values (class labels). array of length n_samples containing the classification/regression labels for training data

views_indarray-like (default=[0, n_features//2, n_features])

Paramater specifying how to extract the data views from X:

  • views_ind is a 1-D array of sorted integers, the entries indicate the limits of the slices used to extract the views, where view n is given by X[:, views_ind[n]:views_ind[n+1]] .

    With this convention each view is therefore a view (in the NumPy sense) of X and no copy of the data is done.

Returns:
selfobject

Returns self.

predict(X)
Parameters:
Xdifferent formats are supported
  • Metriclearn_array {array-like, sparse matrix}, shape = (n_samples, n_features) Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

  • Dictionary of {array like} with shape = (n_samples, n_features) for multi-view for each view.

  • Array of {array like} with shape = (n_samples, n_features) for multi-view for each view.

  • {array like} with (n_samples, nviews * n_features) with ‘views_ind’ diferent to ‘None’

Returns:
ynumpy.ndarray, shape = (n_samples,)

Predicted classes.

score(X, y)

Return the mean accuracy on the given test data and labels.

Parameters:
X{array-like} of shape = (n_samples, n_features)
yarray-like, shape = (n_samples,)

True labels for X.

Returns:
scorefloat

Mean accuracy of self.predict(X) wrt. y.

set_fit_request(*, views_ind: Union[bool, None, str] = '$UNCHANGED$') MVML

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

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

New in version 1.3.

Parameters:
views_indstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for views_ind parameter in fit.

Returns:
selfobject

The updated object.

Module contents

class multimodal.kernels.MKL(lmbda, nystrom_param=1.0, kernel='linear', kernel_params=None, use_approx=True, precision=0.0001, n_loops=50)

Bases: BaseEstimator, ClassifierMixin, MKernel

MKL Classifier for multiview learning

Parameters:
lmbdafloat coeficient for combined kernels
nystrom_paramfloat (default1.0)

value between 0 and 1 indicating level of nyström approximation; 1 = no approximation

kernellist of str (default: “precomputed”) if kernel is as input of fit function set kernel to

“precomputed” list or str indicate the metrics used for each kernels list of pairwise kernel function name (default : “precomputed”) if kernel is as input of fit function set kernel to “precomputed” example : [‘rbf’, ‘additive_chi2’, ‘linear’ ] for function defined in as PAIRWISE_KERNEL_FUNCTIONS

kernel_paramslist of str defaultNone) list of dictionaries for parameters of kernel [{‘gamma’:50}

list of dict of corresponding kernels params KERNEL_PARAMS

use_approx(defaultTrue) to use approximation of m_param < 1
n_loops(default 50) number of iterions
Attributes:
lmbdafloat coeficient for combined kernels
m_paramfloat (default1.0)

value between 0 and 1 indicating level of nyström approximation; 1 = no approximation

kernellist or str indicate the metrics used for each kernels

list of pairwise kernel function name (default : “precomputed”) example : [‘rbf’, ‘additive_chi2’, ‘linear’ ] for function defined in as PAIRWISE_KERNEL_FUNCTIONS example kernel=[‘rbf’, ‘rbf’], for the first two views

kernel_params: list of dict of corresponding kernels params KERNEL_PARAMS
precisionfloat (default1E-4) precision to stop algorithm
n_loopsnumber of iterions
classes_array like unique label for classes
X_metriclearning.datasets.data_sample.Metriclearn_array array of input sample
K_metriclearning.datasets.data_sample.Metriclearn_array array of processed kernels
y_array-like, shape = (n_samples,)

Target values (class labels).

Clearning solution that is learned in MKL
weightslearned weight for combining the solutions of views, learned in
decision_function(X)

Compute the decision function of X.

Parameters:
Xdict dictionary with all views {array like} with shape = (n_samples, n_features) for multi-view

for each view. or MultiModalData , MultiModalArray or {array-like,}, shape = (n_samples, n_features) Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

Returns:
dec_funnumpy.ndarray, shape = (n_samples, )

Decision function of the input samples. For binary classification, values <=0 mean classification in the first class in classes_ and values >0 mean classification in the second class in classes_.

fit(X, y=None, views_ind=None)
Parameters:
Xdifferent formats are supported
  • Metriclearn_array {array-like, sparse matrix}, shape = (n_samples, n_features) Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

  • Dictionary of {array like} with shape = (n_samples, n_features) for multi-view for each view.

  • Array of {array like} with shape = (n_samples, n_features) for multi-view for each view.

  • {array like} with (n_samples, nviews * n_features) with ‘views_ind’ diferent to ‘None’

yarray-like, shape = (n_samples,)

Target values (class labels). array of length n_samples containing the classification/regression labels for training data

views_indarray-like (default=[0, n_features//2, n_features])

Paramater specifying how to extract the data views from X:

  • views_ind is a 1-D array of sorted integers, the entries indicate the limits of the slices used to extract the views, where view n is given by X[:, views_ind[n]:views_ind[n+1]].

    With this convention each view is therefore a view (in the NumPy sense) of X and no copy of the data is done.

Returns:
selfobject

Returns self.

learn_lpMKL()

function of lpMKL learning

Returns:
return tuple (C, weights)
lpMKL_predict(X, C, weights)
Parameters:
Xarray-like test kernels precomputed array like
Ccorresponding to Confusion learned matrix
weightslearned weights
Returns:
ynumpy.ndarray, shape = (n_samples,)

Predicted classes.

predict(X)
Parameters:
Xdict dictionary with all views {array like} with shape = (n_samples, n_features) for multi-view

for each view. or MultiModalData , MultiModalArray or {array-like,}, shape = (n_samples, n_features) Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

views_indarray-like (default=[0, n_features//2, n_features])

Paramater specifying how to extract the data views from X:

  • views_ind is a 1-D array of sorted integers, the entries indicate the limits of the slices used to extract the views, where view n is given by X[:, views_ind[n]:views_ind[n+1]].

    With this convention each view is therefore a view (in the NumPy sense) of X and no copy of the data is done.

Returns:
ynumpy.ndarray, shape = (n_samples,)

Predicted classes.

score(X, y)

Return the mean accuracy on the given test data and labels.

Parameters:
Xdict dictionary with all views {array like} with shape = (n_samples, n_features) for multi-view

for each view. or MultiModalData , MultiModalArray or {array-like,}, shape = (n_samples, n_features) Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

yarray-like, shape = (n_samples,)

True labels for X.

Returns:
scorefloat

Mean accuracy of self.predict(X) wrt. y.

set_fit_request(*, views_ind: Union[bool, None, str] = '$UNCHANGED$') MKL

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

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

New in version 1.3.

Parameters:
views_indstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for views_ind parameter in fit.

Returns:
selfobject

The updated object.

class multimodal.kernels.MVML(lmbda=0.1, eta=1, nystrom_param=1.0, kernel='linear', kernel_params=None, learn_A=1, learn_w=0, precision=0.0001, n_loops=6)

Bases: MKernel, BaseEstimator, ClassifierMixin, RegressorMixin

The MVML Classifier

Parameters:
lmbdafloat regression_params lmbda (default = 0.1) for basic regularization
etafloat regression_params eta (default = 1), first for basic regularization,

regularization of A (not necessary if A is not learned)

kernellist of str (default: “precomputed”) if kernel is as input of fit function set kernel to

“precomputed” list or str indicate the metrics used for each kernels list of pairwise kernel function name (default : “precomputed”) if kernel is as input of fit function set kernel to “precomputed” example : [‘rbf’, ‘additive_chi2’, ‘linear’ ] for function defined in as PAIRWISE_KERNEL_FUNCTIONS

kernel_paramslist of str defaultNone) list of dictionaries for parameters of kernel [{‘gamma’:50}

list of dict of corresponding kernels params KERNEL_PARAMS

nystrom_param: value between 0 and 1 indicating level of nyström approximation; 1 = no approximation
learn_Ainteger (default 1) choose if A is learned or not: 1 - yes (default);

2 - yes, sparse; 3 - no (MVML_Cov); 4 - no (MVML_I)

learn_winteger (default 0) where learn w is needed
precisionfloat (default1E-4) precision to stop algorithm
n_loops(default 6) number of iterions

Examples

>>> from multimodal.kernels.mvml import MVML
>>> from sklearn.datasets import load_iris
>>> X, y = load_iris(return_X_y=True)
>>> y[y>0] = 1
>>> views_ind = [0, 2, 4]  # view 0: sepal data, view 1: petal data
>>> clf = MVML()
>>> clf.get_params()
{'eta': 1, 'kernel': 'linear', 'kernel_params': None, 'learn_A': 1, 'learn_w': 0, 'lmbda': 0.1, 'n_loops': 6, 'nystrom_param': 1.0, 'precision': 0.0001}
>>> clf.fit(X, y, views_ind)  
MVML()
>>> print(clf.predict([[ 5.,  3.,  1.,  1.]]))
0
Attributes:
lmbdafloat regression_params lmbda (default = 0.1)
etafloat regression_params eta (default = 1)
regression_paramsarray/list of regression parameters
kernellist or str indicate the metrics used for each kernels

list of pairwise kernel function name (default : “precomputed”) example : [‘rbf’, ‘additive_chi2’, ‘linear’ ] for function defined in as PAIRWISE_KERNEL_FUNCTIONS example kernel=[‘rbf’, ‘rbf’], for the first two views

kernel_params: list of dict of corresponding kernels params KERNEL_PARAMS
learn_A1 where Learn matrix A is needded
learn_winteger where learn w is needed
precisionfloat (default1E-4) precision to stop algorithm
n_loopsnumber of itterions
n_approxnumber of samples in approximation, equals n if no approx.
classes_array like unique label for classes
warning_messagedictionary with warning messages
X_metriclearning.datasets.data_sample.Metriclearn_array array of input sample
K_metriclearning.datasets.data_sample.Metriclearn_array array of processed kernels
y_array-like, shape = (n_samples,)

Target values (class labels).

regression_if the classifier is used as regression (defaultFalse)
decision_function(X)

Compute the decision function of X.

Parameters:
X{ array-like, sparse matrix},

shape = (n_samples, n_views * n_features) Multi-view input samples. maybe also MultimodalData

Returns:
dec_funnumpy.ndarray, shape = (n_samples, )

Decision function of the input samples. For binary classification, values <=0 mean classification in the first class in classes_ and values >0 mean classification in the second class in classes_.

fit(X, y=None, views_ind=None)

Fit the MVML classifier

Parameters:
X- Metriclearn_array {array-like, sparse matrix}, shape = (n_samples, n_features)

Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

or - Dictionary of {array like} with shape = (n_samples, n_features) for multi-view

for each view.

  • Array of {array like} with shape = (n_samples, n_features) for multi-view for each view.

  • {array like} with (n_samples, nviews * n_features) with ‘views_ind’ diferent to ‘None’

yarray-like, shape = (n_samples,)

Target values (class labels). array of length n_samples containing the classification/regression labels for training data

views_indarray-like (default=[0, n_features//2, n_features])

Paramater specifying how to extract the data views from X:

  • views_ind is a 1-D array of sorted integers, the entries indicate the limits of the slices used to extract the views, where view n is given by X[:, views_ind[n]:views_ind[n+1]] .

    With this convention each view is therefore a view (in the NumPy sense) of X and no copy of the data is done.

Returns:
selfobject

Returns self.

predict(X)
Parameters:
Xdifferent formats are supported
  • Metriclearn_array {array-like, sparse matrix}, shape = (n_samples, n_features) Training multi-view input samples. can be also Kernel where attibute ‘kernel’ is set to precompute “precomputed”

  • Dictionary of {array like} with shape = (n_samples, n_features) for multi-view for each view.

  • Array of {array like} with shape = (n_samples, n_features) for multi-view for each view.

  • {array like} with (n_samples, nviews * n_features) with ‘views_ind’ diferent to ‘None’

Returns:
ynumpy.ndarray, shape = (n_samples,)

Predicted classes.

score(X, y)

Return the mean accuracy on the given test data and labels.

Parameters:
X{array-like} of shape = (n_samples, n_features)
yarray-like, shape = (n_samples,)

True labels for X.

Returns:
scorefloat

Mean accuracy of self.predict(X) wrt. y.

set_fit_request(*, views_ind: Union[bool, None, str] = '$UNCHANGED$') MVML

Configure whether metadata should be requested to be passed to the fit method.

Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with enable_metadata_routing=True (see sklearn.set_config()). Please check the User Guide on how the routing mechanism works.

The options for each parameter are:

  • True: metadata is requested, and passed to fit if provided. The request is ignored if metadata is not provided.

  • False: metadata is not requested and the meta-estimator will not pass it to fit.

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

New in version 1.3.

Parameters:
views_indstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED

Metadata routing for views_ind parameter in fit.

Returns:
selfobject

The updated object.