Flash Sale: Flat 70% + Addl. 25% Off on all Courses | Use Coupon DS25 in Checkout | Offer Expires In

  Enroll Now

Identify Classes of Flowers in Iris dataset using 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
- 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)'.

  • 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)

No hints are availble for this assesment

Answer is not availble for this assesment

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

Loading comments...