small update on book

This commit is contained in:
Morten Hjorth-Jensen
2024-09-03 05:59:13 +02:00
parent 48d4efe695
commit 621836e70c
12 changed files with 938 additions and 909 deletions
File diff suppressed because it is too large Load Diff
@@ -3,9 +3,9 @@
# <!-- HTML file automatically generated from DocOnce source (https://github.com/doconce/doconce/)
# doconce format html week36.do.txt --no_mako -->
# <!-- dom:TITLE: Week 36: Linear Rgeression and Statistical interpretations -->
# <!-- dom:TITLE: Week 36: Linear Regression and Statistical interpretations -->
# # Week 36: Linear Rgeression and Statistical interpretations
# # Week 36: Linear Regression and Statistical interpretations
# **Morten Hjorth-Jensen**, Department of Physics, University of Oslo and Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University
#
# Date: **September 2-6, 2024**
@@ -73,6 +73,8 @@
# penalization of the parameters since their magnitude depends on the
# scale of their corresponding predictor.
#
# The **Scikit-Learn** site <https://scikit-learn.org/stable/auto_examples/preprocessing/plot_all_scaling.html#plot-all-scaling-standard-scaler-section> has a good discussion of different ways of preprocessing data.
#
# Suppose as an example that you
# you have an input variable given by the heights of different persons.
# Human height might be measured in inches or meters or
@@ -292,7 +294,7 @@ beta = fit_beta(X - X_offset, y - y_offset)
intercept = np.mean(y_offset - X_offset @ beta)
print(f"Manual intercept: {intercept}")
print(f"Fitted beta (wiothout intercept): {beta}")
print(f"Fitted beta (without intercept): {beta}")
print(f"Sklearn intercept: {skl.intercept_}")
print(f"Sklearn fitted beta (without intercept): {skl.coef_}")
ypredictOwn = X @ beta