image_output_1.png
from sklearn.linear_model import LinearRegression

from sklearn.model_selection import train_test_split

from sklearn.preprocessing import StandardScaler

import matplotlib.pyplot as plt # pyplot plotting tool

import pandas as pd # data processing

import seaborn as sns # seaborn plotting tool

winedf = pd.read_csv('/kaggle/input/red-wine-quality-cortez-et-al-2009/winequality-red.csv')

winedf.quality.value_counts()

corr = winedf.corr()

X = winedf.iloc[:, :-1]
y = winedf['quality']

from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=21, test_size=0.3)
scaler = StandardScaler().fit(X_train)
standardized_X = scaler.transform(X_train)
standardized_X_test = scaler.transform(X_test)

from sklearn.linear_model import LinearRegression
lr = LinearRegression()
lr.fit(standardized_X, y_train)