Login using Social Account
     Continue with GoogleLogin using your credentials
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)'.
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)
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...