Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
683 B
1
Indexable
Never
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression

df = pd.read_csv('HIGGS.csv', header=None)
df.head()
df.shape
df.describe()

df = df.sample(n=1000000)
df.head()

X = df.iloc[:, 1:]
Y = df.iloc[:, 0]
X.head()
Y.head()

X_train, X_test = train_test_split(X, test_size=0.1)
Y_train, Y_test = train_test_split(Y, test_size=0.1)
print(X_train.shape, X_test.shape, Y_train.shape, Y_test.shape)

logisticRegr = LogisticRegression()
logisticRegr.fit(X_train, Y_train)
predictions = logisticRegr.predict(X_test)
score = logisticRegr.score(X_test, Y_test)
print(score)