-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
30 lines (25 loc) · 931 Bytes
/
model.py
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
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 28 15:03:12 2020
@author: Ayantika
"""
# Importing necessary libraries
import numpy as np
import pandas as pd
from pandas import Series, DataFrame
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
import pickle
# Reading the data
Wine = pd.read_csv("Wine.csv")
print(Wine.head())
#iris.drop("Id", axis=1, inplace = True)
y = Wine['Customer_Segment']
Wine.drop(columns='Customer_Segment',inplace=True)
X = Wine[['Alcohol', 'Malic_Acid', 'Ash', 'Ash_Alcanity', 'Magnesium', 'Total_Phenols', 'Flavanoids',
'Nonflavanoid_Phenols', 'Proanthocyanins', 'Color_Intensity', 'Hue', 'OD280', 'Proline']]
# Training the model
x_train,x_test,y_train,y_test = train_test_split(X,y, test_size=0.3)
model = LogisticRegression()
model.fit(x_train,y_train)
pickle.dump(model,open('model.pkl','wb'))