We can't make this file beautiful and searchable because it's too large.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PostalCode,Latitude,Longitude | |
118547,1.2762,103.7931 | |
118552,1.2765,103.7924 | |
118546,1.2761,103.7931 | |
118549,1.2769,103.7932 | |
118555,1.2773,103.7908 | |
118553,1.2766,103.792 | |
118551,1.2764,103.7928 | |
118554,1.277,103.7909 | |
118556,1.2775,103.7897 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dataset_path = "datasets/purchase100.txt" | |
datahandler = advreg_wrapper.get_datahandler(dataset_path=dataset_path, | |
batch_size=128, | |
training_size=20000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def classification_nn_model(input_features): | |
initializer = tf.compat.v1.keras.initializers.random_normal(0.0, 0.01) | |
model = tf.keras.Sequential( | |
[ | |
keraslayers.Dense( | |
512, | |
activation = tf.nn.tanh, | |
input_shape = (input_features,), | |
kernel_initializer = initializer, | |
bias_initializer = 'zeros' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# `saved_path` is required for obtaining the training data that was used to | |
# train the target classification model, in "npy" format | |
saved_path = "datasets/purchase100.txt.npy" | |
# Similar to `saved_path` being used to form the memberset for attack model, | |
# `dataset_path` is used for forming the non-member set of the training data of | |
# attack model. | |
dataset_path = 'datasets/purchase100.txt' | |
datahandlerA = ml_privacy_meter.utils.attack_data.attack_data(dataset_path=dataset_path, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load the classification model by passing the model, that | |
# you'd like to train, in `model` argument | |
advreg_wrapper.load_classification(model=cmodel, | |
optimizer="adam", | |
learning_rate=0.001) | |
advreg_wrapper.load_inference(optimizer="adam", learning_rate=0.0001) | |
# begins training in an adversarial manner (with defense if _lambda > 0) | |
advreg_wrapper.begin_advreg_training(datahandler=datahandler, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
attackobj = ml_privacy_meter.attack.meminf.initialize( | |
target_train_model=cmodelA, | |
target_attack_model=cmodelA, | |
train_datahandler=datahandlerA, | |
attack_datahandler=datahandlerA, | |
layers_to_exploit=[3, 4], | |
gradients_to_exploit=[4]) | |
attackobj.train_attack() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def classification_nn_model(input_features): | |
initializer = tf.compat.v1.keras.initializers.random_normal(0.0, 0.01) | |
model = tf.keras.Sequential( | |
[ | |
keraslayers.Dense( | |
512, | |
activation = tf.nn.tanh, | |
input_shape = (input_features,), | |
kernel_initializer = initializer, | |
bias_initializer = 'zeros' |