niteshade.utils.train_test_iris

niteshade.utils.train_test_iris(test_size=0.2, val_size=None, rand_state=42)

Loads the Iris dataset using sklearn.datasets.load_iris() and returns the inputs and labels in splitted train and test sets (and validation too if val_size != None). Please note that the returned labels are one-hot encoded.

Parameters
  • test_size (float) – Size of the test set expressed as a fraction of the complete dataset (Default = 0.2)

  • val_size (float) – Size of the validation set expressed as a fraction of the training set. Default = None (i.e only train and test sets are returned)

  • rand_state (int) – random seed with which to split the dataset using sklearn.model_selection.train_test_split(). Default = 42

Returns

Train inputs y_train (np.ndarray) : Train labels X_test (np.ndarray) : Test inputs y_test (np.ndarray) : Test labels X_val (np.ndarray) : Validation inputs (only if val_size != None) y_val (np.ndarray) : Validation labels (only if val_size != None)

Return type

X_train (np.ndarray)