Advertisement
NB52053

AI_LAB_#1

Feb 2nd, 2019
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # coding: utf-8
  3.  
  4. # In[19]:
  5.  
  6.  
  7. import numpy as np
  8. import pandas as pd
  9. from sklearn.model_selection import train_test_split
  10. from sklearn import datasets
  11.  
  12.  
  13. # In[22]:
  14.  
  15.  
  16. iris = datasets.load_iris()
  17. X = iris.data[:, :2]
  18. y = iris.target
  19.  
  20.  
  21. # In[23]:
  22.  
  23.  
  24. X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 42)
  25.  
  26. print('lets check the shape of the data ')
  27. print(X_train.shape[0], X_test.shape[0])
  28. print('\n\n')
  29.  
  30. for i in range(5) :
  31.     print(X_train[i,:], y_train[i])
  32.    
  33.    
  34.  
  35.  
  36. # In[ ]:
  37.  
  38.  
  39.  
  40.  
  41.  
  42. # In[ ]:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement