forked from raminmohammadi/MLOps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.py
More file actions
executable file
·27 lines (25 loc) · 867 Bytes
/
data.py
File metadata and controls
executable file
·27 lines (25 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import numpy as np
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
def load_data():
"""
Load the Iris dataset and return the features and target values.
Returns:
X (numpy.ndarray): The features of the Iris dataset.
y (numpy.ndarray): The target values of the Iris dataset.
"""
iris = load_iris()
X = iris.data
y = iris.target
return X, y
def split_data(X, y):
"""
Split the data into training and testing sets.
Args:
X (numpy.ndarray): The features of the dataset.
y (numpy.ndarray): The target values of the dataset.
Returns:
X_train, X_test, y_train, y_test (tuple): The split dataset.
"""
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=12)
return X_train, X_test, y_train, y_test