Target
Store information about the target model and data.
- class sacroml.attacks.target.Target(model: BaseEstimator | None = None, dataset_name: str = '', features: dict | None = None, X_train: ndarray | None = None, y_train: ndarray | None = None, X_test: ndarray | None = None, y_test: ndarray | None = None, X_orig: ndarray | None = None, y_orig: ndarray | None = None, X_train_orig: ndarray | None = None, y_train_orig: ndarray | None = None, X_test_orig: ndarray | None = None, y_test_orig: ndarray | None = None, proba_train: ndarray | None = None, proba_test: ndarray | None = None)[source]
Store information about the target model and data.
Methods
add_feature
(name, indices, encoding)Add a feature description to the data dictionary.
add_processed_data
(X_train, y_train, X_test, ...)Add a processed and split dataset.
add_raw_data
(X_orig, y_orig, X_train_orig, ...)Add original unprocessed dataset.
add_safemodel_results
(data)Add the results of safemodel disclosure checking.
load
([path])Load the target class from persistent storage.
load_array
(arr_path, name)Load a data array variable from file.
load_model
(model_path)Load the target model.
save
([path, ext])Save the target class to persistent storage.
- __init__(model: BaseEstimator | None = None, dataset_name: str = '', features: dict | None = None, X_train: ndarray | None = None, y_train: ndarray | None = None, X_test: ndarray | None = None, y_test: ndarray | None = None, X_orig: ndarray | None = None, y_orig: ndarray | None = None, X_train_orig: ndarray | None = None, y_train_orig: ndarray | None = None, X_test_orig: ndarray | None = None, y_test_orig: ndarray | None = None, proba_train: ndarray | None = None, proba_test: ndarray | None = None) None [source]
Store information about a target model and associated data.
- Parameters:
- modelsklearn.base.BaseEstimator | None, optional
Trained target model. Any class that implements the sklearn.base.BaseEstimator interface (i.e. has fit, predict and predict_proba methods)
- dataset_namestr
The name of the dataset.
- featuresdict
Dictionary describing the dataset features.
- X_trainnp.ndarray | None
The (processed) training inputs.
- y_trainnp.ndarray | None
The (processed) training outputs.
- X_testnp.ndarray | None
The (processed) testing inputs.
- y_testnp.ndarray | None
The (processed) testing outputs.
- X_orignp.ndarray | None
The original (unprocessed) dataset inputs.
- y_orignp.ndarray | None
The original (unprocessed) dataset outputs.
- X_train_orignp.ndarray | None
The original (unprocessed) training inputs.
- y_train_orignp.ndarray | None
The original (unprocessed) training outputs.
- X_test_orignp.ndarray | None
The original (unprocessed) testing inputs.
- y_test_orignp.ndarray | None
The original (unprocessed) testing outputs.
- proba_trainnp.ndarray | None
The model predicted training probabilities.
- proba_testnp.ndarray | None
The model predicted testing probabilities.
- add_feature(name: str, indices: list[int], encoding: str) None [source]
Add a feature description to the data dictionary.
- add_processed_data(X_train: ndarray, y_train: ndarray, X_test: ndarray, y_test: ndarray) None [source]
Add a processed and split dataset.
- add_raw_data(X_orig: ndarray, y_orig: ndarray, X_train_orig: ndarray, y_train_orig: ndarray, X_test_orig: ndarray, y_test_orig: ndarray) None [source]
Add original unprocessed dataset.
- add_safemodel_results(data: list) None [source]
Add the results of safemodel disclosure checking.
- Parameters:
- datalist
The results of safemodel disclosure checking.
- load(path: str = 'target') None [source]
Load the target class from persistent storage.
- Parameters:
- pathstr
Name of the output folder containing a target yaml file.
- load_array(arr_path: str, name: str) None [source]
Load a data array variable from file.
- Parameters:
- arr_pathstr
Filename of a data array.
- namestr
Name of the data array to load.