-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathheavymodel.py
More file actions
37 lines (30 loc) · 1.21 KB
/
heavymodel.py
File metadata and controls
37 lines (30 loc) · 1.21 KB
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
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-
"""heavyModel.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1D9PGUjRvI3ipnuUsLRr8oywh6TX5k-rI
"""
import pandas as pd
import numpy as np
from sklearn import preprocessing
import matplotlib.pyplot as plt
import time
plt.rc("font", size=14)
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
dataset = pd.read_excel('final_data_cleaned.xlsx')
dataset = dataset.drop(dataset.columns[[0, 1, 2, 3, 4, 5, 6, 7, 9, 10, 12, 13]], axis=1)
X = dataset.iloc[:, :-1].values
X= np.delete(X, 1, 1)
y = dataset.iloc[:, [1]].values
from sklearn import metrics
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=0)
regression = LogisticRegression()
regression.fit(X_train, y_train)
y_pred = regression.predict(X_test)
print('Accuracy of logistic regression classifier on descriptions test set: {:.4f}'.format(regression.score(X_test, y_test)))
from sklearn.metrics import confusion_matrix
confusion_matrix = confusion_matrix(y_test, y_pred)
print(confusion_matrix)
from sklearn.metrics import classification_report
print(classification_report(y_test, y_pred))