Skip to content

Instantly share code, notes, and snippets.

Created February 26, 2020 02:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Display the source blob
Display the rendered blob
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Copy link

## flag is true
X = df[['age', 'gender']]
X = pd.get_dummies(X).values
y = df['treatment']
y = y.values

model = LogisticRegression().fit(X, y)

for column, coef in zip(['age', 'gender'], model.coef_[0]):
    print(f'{column}: {coef}')

print('intercept: ', model.intercept_[0])


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment