July 2019
Beginner to intermediate
740 pages
16h 52m
English
We want to know whether it is possible to tell red and white wine apart based solely on their chemical properties. To test this, we will build a second logistic regression which will predict whether a wine is red or white. First, let's split our data into testing and training sets:
>>> from sklearn.linear_model import LogisticRegression>>> from sklearn.model_selection import train_test_split>>> from sklearn.pipeline import Pipeline>>> from sklearn.preprocessing import StandardScaler>>> wine_y = np.where(wine.kind == 'red', 1, 0)>>> wine_X = wine.drop(columns=['quality', 'kind'])>>> w_X_train, w_X_test, w_y_train, w_y_test = train_test_split(... wine_X, wine_y, test_size=0.25, ... random_state=0, ...
Read now
Unlock full access