Skip to content

Commit

Permalink
simplify reshaping step of input variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
tompollard committed Aug 23, 2022
1 parent eeab0c8 commit 58b5056
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion _episodes/04-modelling.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ from sklearn.linear_model import LinearRegression
reg = LinearRegression()

# use a single feature (apache score)
X = cohort.apachescore.values.reshape((len(cohort.apachescore.values), 1))
X = cohort.apachescore.values.reshape(-1, 1)
y = cohort.actualhospitalmortality_enc.values

# fit the model to our data
Expand Down
4 changes: 2 additions & 2 deletions _episodes/05-validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ 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
x_train = x_train.values.reshape((len(x_train.values), 1))
x_train = x_train.values.reshape(-1, 1)
y_train = y_train.values.ravel()
x_test = x_test.values.reshape((len(x_test.values), 1))
x_test = x_test.values.reshape(-1, 1)
y_test = y_test.values.ravel()

# train model
Expand Down
4 changes: 2 additions & 2 deletions _episodes/06-evaluation.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ 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
x_train = x_train.values.reshape((len(x_train.values), 1))
x_train = x_train.values.reshape(-1, 1)
y_train = y_train.values.ravel()
x_test = x_test.values.reshape((len(x_test.values), 1))
x_test = x_test.values.reshape(-1, 1)
y_test = y_test.values.ravel()

# train model
Expand Down
4 changes: 2 additions & 2 deletions _episodes/07-bootstrapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ 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
x_train = x_train.values.reshape((len(x_train.values), 1))
x_train = x_train.values.reshape(-1, 1)
y_train = y_train.values.ravel()
x_test = x_test.values.reshape((len(x_test.values), 1))
x_test = x_test.values.reshape(-1, 1)
y_test = y_test.values.ravel()

# train model
Expand Down

0 comments on commit 58b5056

Please sign in to comment.