ML Assignment 9
ML Assignment 9
January 3, 2025
data = pd.read_csv(url)
age sex cp trestbps chol fbs restecg thalach exang oldpeak slope \
0 63 1 3 145 233 1 0 150 0 2.3 0
1 37 1 2 130 250 0 1 187 0 3.5 0
2 41 0 1 130 204 0 0 172 0 1.4 2
3 56 1 1 120 236 0 1 178 0 0.8 2
4 57 0 0 120 354 0 1 163 1 0.6 2
ca thal target
0 0 1 1
1 0 2 1
2 0 2 1
3 0 2 1
4 0 2 1
1
age 0
sex 0
cp 0
trestbps 0
chol 0
fbs 0
restecg 0
thalach 0
exang 0
oldpeak 0
slope 0
ca 0
thal 0
target 0
dtype: int64
[3]: # Example assuming 'target' is the target column based on typical naming
X = data.drop('target', axis=1) # Replace 'target' with the actual target␣
↪column name
[7]: LogisticRegression()
Accuracy: 0.8524590163934426