Skip to content

Instantly share code, notes, and snippets.

@kiwamizamurai
Created February 26, 2020 02:02
Show Gist options
  • Save kiwamizamurai/f3aba3e0deddc294776883da70bdd143 to your computer and use it in GitHub Desktop.
Save kiwamizamurai/f3aba3e0deddc294776883da70bdd143 to your computer and use it in GitHub Desktop.
propensity_score-1.ipynb
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kiwamizamurai
Copy link
Author

## 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