Skip to content

Noise Corruptions

Isabel edited this page May 14, 2023 · 15 revisions

Parameters:

X_train: ndarray, dataframe or sparse matrix of shape (n_samples, n_features)
The training input samples. Will be transformed to dataframe object (if it is not already) with column names from column_names property, or index values as names. Can contain the target values if label_name is specified.
y_train: ndarray, dataframe or sparse of shape (n_samples,) or (n_samples, n_outputs), deafult=None
The training target values, labels in classification, real numbers in regression. Required if label_name is None and if it is not included in X_train as a feature.
X_test: ndarray, dataframe or sparse matrix of shape (n_samples, n_features)
The testing input samples. n_features must be equal for X_train and X_test, and in the same order. Will use column_names as specified in the column_names property, or indexes. Can contain the target values if label_name is specified.
corruptions: int, default=10
Number of corruptions to average over for each feature level. Decreasing the number of corruptions will decrease running time, but can make the results of Gaussian noise more vulnerable to outliers drawn from the distribution.
y_test: ndarray, dataframe or sparse of shape (n_samples,) or (n_samples, n_outputs), default=None**
The testing target values. Required if label_name is None and if it is not included in X_test as a feature.
model: object
An object which manages the estimation and decoding of a model. Must either provide a fit and predict method, or these will have to be specified in custom_train and custom_predict.
score_func: str or callable.
Scoring method as string, use sklearn.metrics.get_scorer_names to find available scorers. If callable score function (or loss function) required signature is either score_func(y_pred, y_true) or (model, y_pred, y_true).
corruption_list: dict or list of dicts
Dict of noise corruptions to be performed. The key is a string (or list of strings) corresponding to feature name or index. Values are list of noise method and levels (where applicable). Pass a list of dicts to perform several noise corruptions. See <insert link to examples> for examples.
column_names: list, default=None
List of column names for input samples. Values defaults to index values if None. Not required if X_train is a dataframe with column names.
label_name: str or int, deafult=None
Column name or column index corresponding to the target values. Required if y_train or y_test are None.
feature_importance_measure: {None, "eli5", "lime", "shap"}, default=None
If None default is either coef_ or feature_importances_ attributes where applicable, or <link>permutation importance. Not available for models that use custom fit or predict methods. See further explanation of the other methods <link>here.
random_state: int, RandomState instance or None, deafult=None
Controls randomness in sampling and noise addition.
Note: models with aspects of randomness in training or predicting are not affected by this property, and must be set on model initialization.
plot: bool, default=True
Determines whether plots of feature importances, variance and score are shown.
custom_train: callable, default=None
Callable with signature train_func(model, X, y). Must return trained model object. Not required if model object has fit method with signature fit(X, y).
custom_predict: callable, default=None
Callable with signature predict_func(model, X). Must return list, ndarray, tensor, or dataframe of same length as X. Not required if model object has predict method with signature predict(X).

Returns:

result: Bunch or dict of such instances
Dictionary-like object, with the following attributes:
att1: typed
     ex
att2: typed
     ex
att3: typed
     ex

Clone this wiki locally