Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left

  Apply Now

Project- Iris Flowers Classification using Deep Learning & Keras

6 / 17

Keras Project - Iris Flower Identification - Split the data into Training and Test sets

Now, we will split the data into training and test sets.

The iris dataset is divided into the following parts:
- data
- target
- target_names
- DESCR
- feature_names, and other details

We are mostly interested in the data (which contains the samples divided into 4 features), and the target (which is the target variable, and contains the classes of flowers).

Here, the classes of flowers are 'setosa', 'versicolor', and 'virginica'. The features includes 'sepal length (cm)', 'sepal width (cm)', 'petal length (cm)', and 'petal width (cm)'.

INSTRUCTIONS
  • Load the data part of the dataset into X variable, and target part into y variable

    << your code goes here >> = iris.data
    << your code goes here >> = iris.target
    
  • Next, split the X and y variables into training and test sets using the train_test_split function in a 70/30 ratio

    X_train, X_test, y_train, y_test = train_test_split(<< your code goes here >>, y, test_size=<< your code goes here >>, random_state=42)
    
Get Hint See Answer


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...