Skip to content

Instantly share code, notes, and snippets.

@parulnith
Created March 5, 2023 02:41
Show Gist options
  • Save parulnith/081898c0ea8c8c6b31d1595404864fc5 to your computer and use it in GitHub Desktop.
Save parulnith/081898c0ea8c8c6b31d1595404864fc5 to your computer and use it in GitHub Desktop.
chapter11_page_359
corr = pd.DataFrame(train[features +
[target]].corr(method='spearman')[target]).iloc[:-1]
corr.columns = ['Spearman Correlation Coefficient']
values = [int(i) for i in np.sign(corr.values)]
mono_constraints = dict(zip(corr.index, values))
mono_constraints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment