Skip to content

Instantly share code, notes, and snippets.

@Mehdi-Amine
Created June 24, 2020 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mehdi-Amine/13014cccea168bb57055590bdade8468 to your computer and use it in GitHub Desktop.
Save Mehdi-Amine/13014cccea168bb57055590bdade8468 to your computer and use it in GitHub Desktop.
method to return the false negatives and false positives to their normal scale for inspection
def inverse_scale_for(fp_cases, fn_cases):
# Converting to Numpy to be compatible with Sklearn
fp_cases = x_test[fp_indx].numpy()
fn_cases = x_test[fn_indx].numpy()
# Inverse transformation for the columns that were scaled: tea temp + internet speed
fp_cases_inv = std_scaler.inverse_transform(fp_cases[:,:2])
fn_cases_inv = std_scaler.inverse_transform(fn_cases[:,:2])
# Concatenating the now normally scaled columns with the book column
fp_cases_inv = np.concatenate((fp_cases_inv, fp_cases[:,-1:]), axis=1)
fn_cases_inv = np.concatenate((fn_cases_inv, fn_cases[:,-1:]), axis=1)
return fp_cases_inv, fn_cases_inv
fp_cases_inv, fn_cases_inv = inverse_scale_for(fp_cases, fn_cases)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment