LeaveOutTwinCV

class mastml.data_splitters.LeaveOutTwinCV(threshold=0, ord=2, debug=False, auto_threshold=False, ceiling=0, **kwargs)[source]

Bases: BaseSplitter

Class to remove data twins from the test data.

Args:

threshold: (int), the threshold at which two data points are considered twins. Default 0.

ord: (int), The order of the norm of the difference (see scipy.spatial.distance.minkowski). Default 2 (Euclidean Distance).

auto_threshold: (boolean), true if threshold should be automatically increased until twins corresponding to the ceiling parameter are found. Default False. ceiling: (float), fraction of total data to find as twins. Default 0.

Attributes:

parallel_run: an attribute definining wheteher to run splits with all available computer cores

Methods:
get_n_splits: method to calculate the number of splits to perform across all splitters
Args:

X: (numpy array), array of X features

y: (numpy array), array of y data

groups: (numpy array), array of group labels

Returns:

(int), the number 1 always

split: method to perform split into train indices and test indices
Args:

X: (numpy array), array of X features

y: (numpy array), array of y data

groups: (numpy array), array of group labels

Returns:

(numpy array), array of train and test indices

Methods Summary

get_n_splits([X, y, groups])

Returns the number of splitting iterations in the cross-validator

split(X, y[, X_noinput, groups])

Generate indices to split data into training and test set.

Methods Documentation

get_n_splits(X=None, y=None, groups=None)[source]

Returns the number of splitting iterations in the cross-validator

split(X, y, X_noinput=None, groups=None)[source]

Generate indices to split data into training and test set.

Parameters

Xarray-like of shape (n_samples, n_features)

Training data, where n_samples is the number of samples and n_features is the number of features.

yarray-like of shape (n_samples,)

The target variable for supervised learning problems.

groupsarray-like of shape (n_samples,), default=None

Group labels for the samples used while splitting the dataset into train/test set.

Yields

trainndarray

The training set indices for that split.

testndarray

The testing set indices for that split.