bargavj / EvaluatingDPML

This project's goal is to evaluate the privacy leakage of differentially private machine learning models.
MIT License
129 stars 49 forks source link

I can not run the main.py file in improved_ai #30

Closed Kerwin75631591 closed 1 year ago

Kerwin75631591 commented 1 year ago

FileNotFoundError: [Errno 2] No such file or directory: 'data/census/target_data.npz'

I have census_feature_desc.p ,census_feature.p ,census_feature.csv ,census_labels.p,census_labels.csv but it need target_data.npz,holdout_data.npz,skewed_data.npz,skewed_2_data.npz

input: python main.py census \ --use_cpu=1 \ --skew_attribute=0 \ --skip_corr=1 \ --skew_outcome=3 \ --sensitive_outcome=3 \ --target_test_train_ratio=0.5 \ --target_data_size=50000 \ --candidate_size=10000 \ --target_model='nn' \ --target_epochs=50 \ --target_l2_ratio=1e-6 \ --target_learning_rate=0.001 \ --target_batch_size=500 \ --target_clipping_threshold=4 \ --attribute=1 \ --run=1

output: {'train_dataset': 'census', 'run': 1, 'use_cpu': 1, 'save_model': 0, 'save_data': 0, 'attribute': 1, 'candidate_size': 10000, 'skew_attribute': 0, 'skew_outcome': 3, 'sensitive_outcome': 3, 'banished_records': 0, 'skip_corr': 1, 'n_shadow': 5, 'target_data_size': 50000, 'target_test_train_ratio': 0.5, 'target_model': 'nn', 'target_learning_rate': 0.001, 'target_batch_size': 500, 'target_n_hidden': 256, 'target_epochs': 50, 'target_l2_ratio': 1e-06, 'target_clipping_threshold': 4.0, 'target_privacy': 'no_privacy', 'target_dp': 'gdp', 'target_epsilon': 0.5, 'target_delta': 1e-05, 'attack_model': 'nn', 'attack_learning_rate': 0.01, 'attack_batch_size': 100, 'attack_n_hidden': 64, 'attack_epochs': 100, 'attack_l2_ratio': 1e-06} Traceback (most recent call last): File "/Users/zhouyukai/PycharmProjects/EvaluatingDPML-master/improved_ai/main.py", line 332, in run_experiment(args) File "/Users/zhouyukai/PycharmProjects/EvaluatingDPML-master/improved_ai/main.py", line 135, in run_experiment train_x, train_y, test_x, test_y = load_data('target_data.npz', args) File "/Users/zhouyukai/PycharmProjects/EvaluatingDPML-master/core/data_util.py", line 204, in load_data with np.load(DATA_PATH + data_name) as f: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/numpy/lib/npyio.py", line 390, in load fid = stack.enter_context(open(os_fspath(file), "rb")) FileNotFoundError: [Errno 2] No such file or directory: 'data/census/target_data.npz'

bargavj commented 1 year ago

Hi, apologies for the late reply. You would need to run the main.py code with --save_data=1 flag for the first time which will generate these .npz files. Afterward, you can remove this flag and run the code as usual.