secml.ml.features.reduction¶
CReducer¶
-
class
secml.ml.features.reduction.c_reducer.CReducer(preprocess=None)[source]¶ Bases:
secml.ml.features.c_preprocess.CPreProcessInterface for feature dimensionality reduction algorithms.
- Attributes
class_typeDefines class type.
loggerLogger for current object.
preprocessInner preprocessor (if any).
verboseVerbosity level of logger output.
Methods
copy(self)Returns a shallow copy of current class.
create([class_item])This method creates an instance of a class with given type.
create_chain(class_items, kwargs_list)Creates a chain of preprocessors.
deepcopy(self)Returns a deep copy of current class.
fit(self, x[, y])Fit transformation algorithm.
fit_transform(self, x[, y])Fit preprocessor using data and then transform data.
get_class_from_type(class_type)Return the class associated with input type.
get_params(self)Returns the dictionary of class parameters.
get_subclasses()Get all the subclasses of the calling class.
gradient(self, x[, w])Returns the preprocessor gradient wrt data.
list_class_types()This method lists all types of available subclasses of calling one.
load(path)Loads class from pickle object.
revert(self, x)Revert data to original form.
save(self, path)Save class object using pickle.
set(self, param_name, param_value[, copy])Set a parameter that has a specific name to a specific value.
set_params(self, params_dict[, copy])Set all parameters passed as a dictionary {key: value}.
timed([msg])Timer decorator.
transform(self, x)Apply the transformation algorithm on data.
CLDA¶
-
class
secml.ml.features.reduction.c_reducer_lda.CLDA(n_components=None, preprocess=None)[source]¶ Bases:
secml.ml.features.reduction.c_reducer.CReducerLinear Discriminant Analysis (LDA).
- Parameters
- preprocessCPreProcess or str or None, optional
Features preprocess to be applied to input data. Can be a CPreProcess subclass or a string with the type of the desired preprocessor. If None, input data is used as is.
- Attributes
class_type‘lda’Defines class type.
Methods
copy(self)Returns a shallow copy of current class.
create([class_item])This method creates an instance of a class with given type.
create_chain(class_items, kwargs_list)Creates a chain of preprocessors.
deepcopy(self)Returns a deep copy of current class.
fit(self, x[, y])Fit transformation algorithm.
fit_transform(self, x[, y])Fit preprocessor using data and then transform data.
get_class_from_type(class_type)Return the class associated with input type.
get_params(self)Returns the dictionary of class parameters.
get_subclasses()Get all the subclasses of the calling class.
gradient(self, x[, w])Returns the preprocessor gradient wrt data.
list_class_types()This method lists all types of available subclasses of calling one.
load(path)Loads class from pickle object.
revert(self, x)Revert data to original form.
save(self, path)Save class object using pickle.
set(self, param_name, param_value[, copy])Set a parameter that has a specific name to a specific value.
set_params(self, params_dict[, copy])Set all parameters passed as a dictionary {key: value}.
timed([msg])Timer decorator.
transform(self, x)Apply the transformation algorithm on data.
-
property
classes¶ Unique targets used for training.
-
property
eigenvec¶ Eigenvectors estimated from the training data. Is a matrix of shape: n_eigenvectors * n_features.
-
property
mean¶ Per-feature empirical mean, estimated from the training data.
CPCA¶
-
class
secml.ml.features.reduction.c_reducer_pca.CPCA(n_components=None, preprocess=None)[source]¶ Bases:
secml.ml.features.reduction.c_reducer.CReducerPrincipal Component Analysis (PCA).
- Parameters
- preprocessCPreProcess or str or None, optional
Features preprocess to be applied to input data. Can be a CPreProcess subclass or a string with the type of the desired preprocessor. If None, input data is used as is.
- Attributes
class_type‘pca’Defines class type.
Methods
copy(self)Returns a shallow copy of current class.
create([class_item])This method creates an instance of a class with given type.
create_chain(class_items, kwargs_list)Creates a chain of preprocessors.
deepcopy(self)Returns a deep copy of current class.
fit(self, x[, y])Fit transformation algorithm.
fit_transform(self, x[, y])Fit preprocessor using data and then transform data.
get_class_from_type(class_type)Return the class associated with input type.
get_params(self)Returns the dictionary of class parameters.
get_subclasses()Get all the subclasses of the calling class.
gradient(self, x[, w])Returns the preprocessor gradient wrt data.
list_class_types()This method lists all types of available subclasses of calling one.
load(path)Loads class from pickle object.
revert(self, x)Revert data to original form.
save(self, path)Save class object using pickle.
set(self, param_name, param_value[, copy])Set a parameter that has a specific name to a specific value.
set_params(self, params_dict[, copy])Set all parameters passed as a dictionary {key: value}.
timed([msg])Timer decorator.
transform(self, x)Apply the transformation algorithm on data.
-
property
components¶ Eigenvectors of inverse training array.
-
property
eigenval¶ Eigenvalues estimated from the training data.
-
property
eigenvec¶ Eigenvectors estimated from the training data.
-
property
explained_variance¶ Variance explained by each of the selected components.
-
property
explained_variance_ratio¶ Percentage of variance explained by each of the selected components.
If n_components is None, then all components are stored and the sum of explained variances is equal to 1.0
-
property
mean¶ Per-feature empirical mean, estimated from the training data.