Skip to content

Commit

Permalink
deploy: 49001cf
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorcampbell committed Nov 22, 2023
1 parent 241bfac commit 1e21eb3
Show file tree
Hide file tree
Showing 13 changed files with 750 additions and 750 deletions.
16 changes: 8 additions & 8 deletions pull317/_sources/regression1.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ us the smallest RMSPE.
from sklearn.neighbors import KNeighborsRegressor
# (synthetic) new prediction points
pts = pd.DataFrame({"sqft": [1250, 1850, 2250], "price": [250000, 200000, 500000]})
finegrid = pd.DataFrame({"sqft": np.arange(900, 3901, 10)})
pts = pd.DataFrame({"sqft": [1200, 1850, 2250], "price": [300000, 200000, 500000]})
finegrid = pd.DataFrame({"sqft": np.arange(600, 3901, 10)})
# preprocess the data, make the pipeline
sacr_preprocessor = make_column_transformer((StandardScaler(), ["sqft"]))
Expand All @@ -495,22 +495,22 @@ sacr_full_preds_hid = pd.concat(
)
sacr_new_preds_hid = pd.concat(
(pts, pd.DataFrame(sacr_pipeline.predict(pts), columns=["predicted"])),
(small_sacramento[["sqft", "price"]].reset_index(), pd.DataFrame(sacr_pipeline.predict(small_sacramento[["sqft", "price"]]), columns=["predicted"])),
axis=1,
)
).drop(columns=["index"])
# to make altair mark_line works, need to create separate dataframes for each vertical error line
sacr_new_preds_melted_df = sacr_new_preds_hid.melt(id_vars=["sqft"])
errors_plot = (
small_plot
+ alt.Chart(sacr_full_preds_hid).mark_line(color="#ff7f0e").encode(x="sqft", y="predicted")
+ alt.Chart(sacr_new_preds_hid)
.mark_circle(opacity=1)
.encode(x="sqft", y="price")
)
sacr_new_preds_melted_df = sacr_new_preds_hid.melt(id_vars=["sqft"])
v_lines = []
for i in pts["sqft"]:
line_df = sacr_new_preds_melted_df.query("sqft == @i")
for i in sacr_new_preds_hid["sqft"]:
line_df = sacr_new_preds_melted_df.query(f"sqft == {i}")
v_lines.append(alt.Chart(line_df).mark_line(color="black").encode(x="sqft", y="value"))
errors_plot = alt.layer(*v_lines, errors_plot)
Expand All @@ -526,7 +526,7 @@ glue("fig:07-verticalerrors", errors_plot, display=False)
:::{glue:figure} fig:07-verticalerrors
:name: fig:07-verticalerrors

Scatter plot of price (USD) versus house size (square feet) with example predictions (orange line) and the error in those predictions compared with true response values for three selected observations (vertical lines).
Scatter plot of price (USD) versus house size (square feet) with example predictions (orange line) and the error in those predictions compared with true response values (vertical lines).
:::

+++
Expand Down
2 changes: 1 addition & 1 deletion pull317/_sources/regression2.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ Scatter plot of sale price versus size with many possible lines that could be dr

Simple linear regression chooses the straight line of best fit by choosing
the line that minimizes the **average squared vertical distance** between itself and
each of the observed data points in the training data. {numref}`fig:08-verticalDistToMin` illustrates
each of the observed data points in the training data (equivalent to minimizing the RMSE). {numref}`fig:08-verticalDistToMin` illustrates
these vertical distances as lines. Finally, to assess the predictive
accuracy of a simple linear regression model,
we use RMSPE—the same measure of predictive performance we used with K-NN regression.
Expand Down
204 changes: 102 additions & 102 deletions pull317/classification1.html

Large diffs are not rendered by default.

156 changes: 78 additions & 78 deletions pull317/classification2.html

Large diffs are not rendered by default.

182 changes: 91 additions & 91 deletions pull317/clustering.html

Large diffs are not rendered by default.

182 changes: 91 additions & 91 deletions pull317/inference.html

Large diffs are not rendered by default.

70 changes: 35 additions & 35 deletions pull317/intro.html

Large diffs are not rendered by default.

Binary file modified pull317/objects.inv
Binary file not shown.
132 changes: 66 additions & 66 deletions pull317/regression1.html

Large diffs are not rendered by default.

160 changes: 80 additions & 80 deletions pull317/regression2.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pull317/searchindex.js

Large diffs are not rendered by default.

392 changes: 196 additions & 196 deletions pull317/viz.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pull317/wrangling.html
Original file line number Diff line number Diff line change
Expand Up @@ -4790,7 +4790,7 @@ <h2><span class="section-number">3.9. </span>Performing operations on groups of
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;pandas.core.groupby.generic.DataFrameGroupBy object at 0x7fbc92338f90&gt;
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;pandas.core.groupby.generic.DataFrameGroupBy object at 0x7ff9d6ae8950&gt;
</pre></div>
</div>
</div>
Expand Down

0 comments on commit 1e21eb3

Please sign in to comment.