Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

robustify.py 499 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
  1. import numpy as np
  2. def robust_measure(df, func):
  3. original_feature = np.array([func(df.iloc[i].X) for i in range(len(df))])
  4. res = []
  5. for noise_level in range(1, 500, 20):
  6. new_feature = np.array([func(df.iloc[i].X +
  7. noise_level*np.random.normal(size=len(df.iloc[i].X)))
  8. for i in range(len(df))])
  9. res.append(np.corrcoef(np.transpose(original_feature), np.transpose(new_feature))[0,1])
  10. return res
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...