Skip to content

Instantly share code, notes, and snippets.


justmarkham/ Secret

Last active Apr 25, 2020
What would you like to do?
import pandas as pd
from sklearn.preprocessing import OneHotEncoder
from sklearn.linear_model import LogisticRegression
from sklearn.compose import make_column_transformer
from sklearn.pipeline import make_pipeline
cols = ['Parch', 'Fare', 'Embarked', 'Sex']
df = pd.read_csv('', nrows=10)
X = df[cols]
y = df['Survived']
df_new = pd.read_csv('', nrows=10)
X_new = df_new[cols]
ohe = OneHotEncoder()
ct = make_column_transformer(
(ohe, ['Embarked', 'Sex']),
logreg = LogisticRegression(solver='liblinear', random_state=1)
pipe = make_pipeline(ct, logreg), y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.