Data Checks

The physlearn.supervised.utils._data_checks module provides basic utilities for automated data checking.

physlearn.supervised.utils._data_checks._check_X(X)[source]

Checks if the design matrix uses a pandas data representation.

Parameters

X (array-like of shape = [n_samples, n_features]) – The design matrix, where each row corresponds to an example and the column(s) correspond to the feature(s).

Returns

X

Return type

pd.Series or pd.DataFrame

physlearn.supervised.utils._data_checks._check_y(y)[source]

Checks if the target matrix uses a pandas data representation.

Parameters

y (array-like of shape = [n_samples] or shape = [n_samples, n_targets]) – The target matrix, where each row corresponds to an example and the column(s) correspond to the single-target(s).

Returns

y

Return type

pd.Series or pd.DataFrame

physlearn.supervised.utils._data_checks._check_X_y(X, y)[source]

Checks if the design and target matrices use a pandas data representations.

Parameters
  • X (array-like of shape = [n_samples, n_features]) – The design matrix, where each row corresponds to an example and the column(s) correspond to the feature(s).

  • y (array-like of shape = [n_samples] or shape = [n_samples, n_targets]) – The target matrix, where each row corresponds to an example and the column(s) correspond to the single-target(s).

Returns

data

Return type

tuple

physlearn.supervised.utils._data_checks._validate_data(X=None, y=None)[source]

Bundles the pandas data checks together.

Parameters
  • X (array-like of shape = [n_samples, n_features] or None, optional (default=None)) – The design matrix, where each row corresponds to an example and the column(s) correspond to the feature(s).

  • y (array-like of shape = [n_samples] or shape = [n_samples, n_targets] or None, optional (default=None)) – The target matrix, where each row corresponds to an example and the column(s) correspond to the single-target(s).

Returns

data

Return type

tuple, pd.Series, or pd.DataFrame

physlearn.supervised.utils._data_checks._n_features(X)[source]

Counts the number of features in the design matrix.

Parameters

X (array-like of shape = [n_samples, n_features] or None, optional (default=None)) – The design matrix, where each row corresponds to an example and the column(s) correspond to the feature(s).

Returns

dim

Return type

int

physlearn.supervised.utils._data_checks._n_targets(y)[source]

Counts the number of targets in the target matrix.

Parameters

y (array-like of shape = [n_samples] or shape = [n_samples, n_targets] or None, optional (default=None)) – The target matrix, where each row corresponds to an example and the column(s) correspond to the single-target(s).

Returns

dim

Return type

int

physlearn.supervised.utils._data_checks._n_samples(y)[source]

Counts the number of observations in the target matrix.

Parameters

y (array-like of shape = [n_samples] or shape = [n_samples, n_targets] or None, optional (default=None)) – The target matrix, where each row corresponds to an example and the column(s) correspond to the single-target(s).

Returns

samples

Return type

int