Spaces:
Runtime error
Runtime error
# -*- 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') |