Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %matplotlib inline
- fig = plt.figure(figsize=(25, 25))
- fig.subplots(nrows=7, ncols=2)
- for feat_i in range(number_of_features): #For each feature, we have a new subplot
- ax = plt.subplot(7,2, feat_i+1)
- plt.title(feature_names[feat_i])
- sns.distplot(X[:,feat_i]) #Once we have a specific feature, we draw the histogram of the feature's data (X[:,i] means we get the i'th column of X)
- for class_i in range(number_of_classes): #After that we draw the within-class histograms of the same feature
- sns.distplot(X[y == class_i,feat_i], color=colors[class_i], label=target_names[class_i]) # (X[y==c,i] means we get the i'th column of X where the class in the same row in y is equal to c
- plt.legend()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement