Aiml Ex3

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Practicle No.

3 1

Program:-

# Load libraries
import pandas as pd
from sklearn.model_selection import train_test_split
#Import train_test_split function

# load dataset

data=pd.read_csv(r"E:\pythonProject_experiment\pima-indians-
diabetes.csv")
print(data)
#split dataset in features and target variable
X=data.iloc[:,1:9]
Y=data.iloc[:,-1]

# Split dataset into training set and test set

X_train, X_test, y_train, y_test = train_test_split(X, Y,


test_size=0.3, random_state=1) # 70% training and 30% test

print("The training data for X is \n\n",X_train)

print("The training data for Y is \n\n",y_train)

Artificial Intelligence & Machine Learning Mechanical Engineering Department

You might also like