From 15659f871d99649b41b080440288ba94f22a3447 Mon Sep 17 00:00:00 2001 From: Tom Pollard Date: Mon, 22 Aug 2022 22:41:47 -0400 Subject: [PATCH] note on adding more input variables. --- _episodes/04-modelling.md | 1 + _episodes/05-validation.md | 1 + _episodes/06-evaluation.md | 1 + _episodes/07-bootstrapping.md | 1 + 4 files changed, 4 insertions(+) diff --git a/_episodes/04-modelling.md b/_episodes/04-modelling.md index 2720304..3f51157 100644 --- a/_episodes/04-modelling.md +++ b/_episodes/04-modelling.md @@ -39,6 +39,7 @@ from sklearn.linear_model import LinearRegression reg = LinearRegression() # use a single feature (apache score) +# note: remove the reshape if fitting to >1 input variable X = cohort.apachescore.values.reshape(-1, 1) y = cohort.actualhospitalmortality_enc.values diff --git a/_episodes/05-validation.md b/_episodes/05-validation.md index 2f40b1f..0a84643 100644 --- a/_episodes/05-validation.md +++ b/_episodes/05-validation.md @@ -50,6 +50,7 @@ y = cohort[outcome] x_train, x_test, y_train, y_test = train_test_split(X, y, train_size = 0.7, random_state = 42) # restructure data for input into model +# note: remove the reshape if fitting to >1 input variable x_train = x_train.values.reshape(-1, 1) y_train = y_train.values.ravel() x_test = x_test.values.reshape(-1, 1) diff --git a/_episodes/06-evaluation.md b/_episodes/06-evaluation.md index cb5d5aa..c2a2d8e 100644 --- a/_episodes/06-evaluation.md +++ b/_episodes/06-evaluation.md @@ -44,6 +44,7 @@ y = cohort[outcome] x_train, x_test, y_train, y_test = train_test_split(X, y, train_size = 0.7, random_state = 42) # restructure data for input into model +# note: remove the reshape if fitting to >1 input variable x_train = x_train.values.reshape(-1, 1) y_train = y_train.values.ravel() x_test = x_test.values.reshape(-1, 1) diff --git a/_episodes/07-bootstrapping.md b/_episodes/07-bootstrapping.md index 33f3896..99d82b2 100644 --- a/_episodes/07-bootstrapping.md +++ b/_episodes/07-bootstrapping.md @@ -55,6 +55,7 @@ y = cohort[outcome] x_train, x_test, y_train, y_test = train_test_split(X, y, train_size = 0.7, random_state = 42) # restructure data for input into model +# note: remove the reshape if fitting to >1 input variable x_train = x_train.values.reshape(-1, 1) y_train = y_train.values.ravel() x_test = x_test.values.reshape(-1, 1)