inv-rep
inv-rep copied to clipboard
Reproducing classifier accuracy on learned codes
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_paramscontaining tf checkpoints and models -
out_evalscontaining a number of.zfiles which, to the best of my understanding, contain the learned codes and associated labels corresponding to the sensible parameterc. 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!