Spaces:
Runtime error
Runtime error
File size: 1,231 Bytes
0ae6124 |
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 38 |
# -*- coding: utf-8 -*-
"""Untitled0.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1TrLYru7HIkMCSYavUVhf6DZ-5lYqp3zI
"""
import pandas as pd
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import StandardScaler
from sklearn.tree import DecisionTreeClassifier
df=pd.read_csv('wine_red.csv')
df.drop(['residual_sugar','pH','free_sulfur_dioxide'],axis=1,inplace=True)
X_train = df.drop('quality',axis=1)
y_train = df.pop("quality")
num_col = X_train.select_dtypes(include=['int64', 'float64']).columns
preprocessor = ColumnTransformer([("scaler", StandardScaler(), num_col)])
num_col = X_train.select_dtypes(include=['int64', 'float64']).columns
preprocessor = ColumnTransformer([("scaler", StandardScaler(), num_col)])
model = Pipeline(steps=[('preprocessor', preprocessor), ('decisiontree', DecisionTreeClassifier())])
model.fit(X_train, y_train)
model = Pipeline(steps=[('scaler', StandardScaler()),
('decisiontree', DecisionTreeClassifier())])
model.fit(X_train, y_train)
"""### Saving the model"""
import joblib
joblib.dump(model,'model.joblib') |