Advertisement
Guest User

Untitled

a guest
Jan 27th, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #Importing mutual_info_score function to calculate the mutual information between two variables.
  2. from sklearn.metrics import mutual_info_score
  3.  
  4. #Generating the dataset
  5.  
  6. a1 = [2, 5, 3, 1, 2, 3, 2, 6, 7]
  7. a2 = [3, 3, 1, 9, 9, 9, 0, 0, 0]
  8. a3 = [2, 2, 2, 6, 6, 6, 4, 4, 4]
  9. y = [0, 0, 0, 1, 1, 1, 2, 2, 2]
  10.  
  11. # Finding mutual information score
  12.  
  13. print mutual_info_score(a1, y)
  14. print mutual_info_score(a1, y)
  15. print mutual_info_score(a1, y)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement