Skip to content

Commit 3f5e20b

Browse files
fit consistency and minor bugfix in reg2
1 parent 66b6f68 commit 3f5e20b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

source/regression2.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,8 @@ method as usual.
726726

727727
```{code-cell} ipython3
728728
729-
mlm = LinearRegression().fit(
729+
mlm = LinearRegression()
730+
mlm.fit(
730731
sacramento_train[["sqft", "beds"]],
731732
sacramento_train["price"]
732733
)
@@ -838,11 +839,12 @@ Unfortunately you have to do this mapping yourself: the coefficients in `mlm.coe
838839
in the *same order* as the columns of the predictor data frame you used when training.
839840
So since we used `sacramento_train[["sqft", "beds"]]` when training,
840841
we have that `mlm.coef_[0]` corresponds to `sqft`, and `mlm.coef_[1]` corresponds to `beds`.
842+
Once you sort out the correspondence, you can then use those slopes to write a mathematical equation to describe the prediction plane:
841843

842844
```{index} plane equation
843845
```
844846

845-
And then use those slopes to write a mathematical equation to describe the prediction plane:
847+
846848

847849
$$\text{house sale price} = \beta_0 + \beta_1\cdot(\text{house size}) + \beta_2\cdot(\text{number of bedrooms}),$$
848850
where:

0 commit comments

Comments
 (0)