inv-rep icon indicating copy to clipboard operation
inv-rep copied to clipboard

Reproducing classifier accuracy on learned codes

Open Pibborn opened this issue 6 years ago • 0 comments

Hi,

thank you for releasing the code for your paper! It makes things a lot easier for other researchers in the same area.

I have a question about reproducing your paper's experimental results on the adult dataset. I have run the experimental_script.sh script and obtained a couple of new folders:

  • out_params containing tf checkpoints and models
  • out_evals containing a number of .z files which, to the best of my understanding, contain the learned codes and associated labels corresponding to the sensible parameter c. Each file has a name such as [...]/inv-rep/out_evals/adult/l0.0001_b0.01_d30/test/grid_navib_epoch[num_epochs]_z_and_c.z.

Now, would my script below be a reasonable way to reproduce your results as far as the "adversarial loss" (i.e. a supervised classifier's accuracy on the codes when trying to predict the sensible attribute) is concerned?

import joblib
import sklearn
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score

z_test, s_test = joblib.load('../out_evals/adult/l0.0001_b0.01_d30/test/grid_navib_epoch500_z_and_c.z')
z_val, s_val = joblib.load('../out_evals/adult/l0.0001_b0.01_d30/val/grid_navib_epoch500_z_and_c.z')
z_train, s_train = joblib.load('../out_evals/adult/l0.0001_b0.01_d30/train/grid_navib_epoch500_z_and_c.z')

model = LogisticRegression() # or any other model for that matter
model.fit(z_train, s_train)
s_pred = model.predict(z_test)
print(accuracy_score(s_test, s_pred))

Thank you kindly!

Pibborn avatar Aug 16 '19 13:08 Pibborn