Skip to content

Instantly share code, notes, and snippets.

@stasSajin
Created October 31, 2018 04:59
Show Gist options
  • Save stasSajin/3e8dc8f2bc55cb70418e66381d50dd68 to your computer and use it in GitHub Desktop.
Save stasSajin/3e8dc8f2bc55cb70418e66381d50dd68 to your computer and use it in GitHub Desktop.
bias_var = np.array('gender_male')
bias_idx = np.argwhere(np.isin(np.array(feature_names), bias_var))[0]
interactions[:, bias_idx, :] = 0
interactions[:, :, bias_idx] = 0
y_hat_no_bias = np.exp(interactions.sum(axis = 1).sum(axis = 1)) - 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment