update
This commit is contained in:
@@ -41,24 +41,21 @@ Automatically generated HTML file from DocOnce source
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Why Linear Regression (aka Ordinary Least Squares and family)',
|
||||
'sections': [('To do list', 2, None, '___sec0'),
|
||||
('Why Linear Regression (aka Ordinary Least Squares and family)',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Regression analysis, overarching aims', 2, None, '___sec1'),
|
||||
('Regression analysis, overarching aims II', 2, None, '___sec2'),
|
||||
('Examples', 2, None, '___sec3'),
|
||||
('General linear models', 2, None, '___sec4'),
|
||||
'___sec1'),
|
||||
('Regression analysis, overarching aims', 2, None, '___sec2'),
|
||||
('Regression analysis, overarching aims II', 2, None, '___sec3'),
|
||||
('Examples', 2, None, '___sec4'),
|
||||
('General linear models', 2, None, '___sec5'),
|
||||
('Rewriting the fitting procedure as a linear algebra problem',
|
||||
2,
|
||||
None,
|
||||
'___sec5'),
|
||||
'___sec6'),
|
||||
('Rewriting the fitting procedure as a linear algebra problem, '
|
||||
'more details',
|
||||
2,
|
||||
None,
|
||||
'___sec6'),
|
||||
('Generalizing the fitting procedure as a linear algebra problem',
|
||||
2,
|
||||
None,
|
||||
'___sec7'),
|
||||
@@ -66,184 +63,188 @@ Automatically generated HTML file from DocOnce source
|
||||
2,
|
||||
None,
|
||||
'___sec8'),
|
||||
('Optimizing our parameters', 2, None, '___sec9'),
|
||||
('Generalizing the fitting procedure as a linear algebra problem',
|
||||
2,
|
||||
None,
|
||||
'___sec9'),
|
||||
('Optimizing our parameters', 2, None, '___sec10'),
|
||||
('Our model for the nuclear binding energies',
|
||||
2,
|
||||
None,
|
||||
'___sec10'),
|
||||
('Optimizing our parameters, more details', 2, None, '___sec11'),
|
||||
('Interpretations and optimizing our parameters',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
'___sec11'),
|
||||
('Optimizing our parameters, more details', 2, None, '___sec12'),
|
||||
('Interpretations and optimizing our parameters',
|
||||
2,
|
||||
None,
|
||||
'___sec13'),
|
||||
('Some useful matrix and vector expressions',
|
||||
2,
|
||||
None,
|
||||
'___sec14'),
|
||||
('Interpretations and optimizing our parameters',
|
||||
2,
|
||||
None,
|
||||
'___sec14'),
|
||||
('Some useful matrix and vector expressions',
|
||||
2,
|
||||
None,
|
||||
'___sec15'),
|
||||
('Own code for Ordinary Least Squares', 2, None, '___sec16'),
|
||||
('Interpretations and optimizing our parameters',
|
||||
2,
|
||||
None,
|
||||
'___sec16'),
|
||||
('Own code for Ordinary Least Squares', 2, None, '___sec17'),
|
||||
('Adding error analysis and training set up',
|
||||
2,
|
||||
None,
|
||||
'___sec17'),
|
||||
('The $\\chi^2$ function', 2, None, '___sec18'),
|
||||
'___sec18'),
|
||||
('The $\\chi^2$ function', 2, None, '___sec19'),
|
||||
('The $\\chi^2$ function', 2, None, '___sec20'),
|
||||
('The $\\chi^2$ function', 2, None, '___sec21'),
|
||||
('The $\\chi^2$ function', 2, None, '___sec22'),
|
||||
('The $\\chi^2$ function', 2, None, '___sec23'),
|
||||
('The $\\chi^2$ function', 2, None, '___sec24'),
|
||||
('Fitting an Equation of State for Dense Nuclear Matter',
|
||||
2,
|
||||
None,
|
||||
'___sec24'),
|
||||
('The code', 2, None, '___sec25'),
|
||||
'___sec25'),
|
||||
('The code', 2, None, '___sec26'),
|
||||
('Splitting our Data in Training and Test data',
|
||||
2,
|
||||
None,
|
||||
'___sec26'),
|
||||
('The Boston housing data example', 2, None, '___sec27'),
|
||||
('Housing data, the code', 2, None, '___sec28'),
|
||||
('The singular value decomposition', 2, None, '___sec29'),
|
||||
('Linear Regression Problems', 2, None, '___sec30'),
|
||||
('Fixing the singularity', 2, None, '___sec31'),
|
||||
('Basic math of the SVD', 2, None, '___sec32'),
|
||||
('The SVD, a Fantastic Algorithm', 2, None, '___sec33'),
|
||||
('Another Example', 2, None, '___sec34'),
|
||||
('Economy-size SVD', 2, None, '___sec35'),
|
||||
('Mathematical Properties', 2, None, '___sec36'),
|
||||
('Ridge and LASSO Regression', 2, None, '___sec37'),
|
||||
('More on Ridge Regression', 2, None, '___sec38'),
|
||||
('Interpreting the Ridge results', 2, None, '___sec39'),
|
||||
('More interpretations', 2, None, '___sec40'),
|
||||
('Codes for the SVD', 2, None, '___sec41'),
|
||||
('A better understanding of regularization', 2, None, '___sec42'),
|
||||
'___sec27'),
|
||||
('The Boston housing data example', 2, None, '___sec28'),
|
||||
('Housing data, the code', 2, None, '___sec29'),
|
||||
('The singular value decomposition', 2, None, '___sec30'),
|
||||
('Linear Regression Problems', 2, None, '___sec31'),
|
||||
('Fixing the singularity', 2, None, '___sec32'),
|
||||
('Basic math of the SVD', 2, None, '___sec33'),
|
||||
('The SVD, a Fantastic Algorithm', 2, None, '___sec34'),
|
||||
('Another Example', 2, None, '___sec35'),
|
||||
('Economy-size SVD', 2, None, '___sec36'),
|
||||
('Mathematical Properties', 2, None, '___sec37'),
|
||||
('Ridge and LASSO Regression', 2, None, '___sec38'),
|
||||
('More on Ridge Regression', 2, None, '___sec39'),
|
||||
('Interpreting the Ridge results', 2, None, '___sec40'),
|
||||
('More interpretations', 2, None, '___sec41'),
|
||||
('Codes for the SVD', 2, None, '___sec42'),
|
||||
('A better understanding of regularization', 2, None, '___sec43'),
|
||||
('Decomposing the OLS and Ridge expressions',
|
||||
2,
|
||||
None,
|
||||
'___sec43'),
|
||||
('Spectral Decomposition of the OLS', 2, None, '___sec44'),
|
||||
('Where are we going?', 2, None, '___sec45'),
|
||||
('Resampling methods', 2, None, '___sec46'),
|
||||
'___sec44'),
|
||||
('Spectral Decomposition of the OLS', 2, None, '___sec45'),
|
||||
('Where are we going?', 2, None, '___sec46'),
|
||||
('Resampling methods', 2, None, '___sec47'),
|
||||
('Resampling approaches can be computationally expensive',
|
||||
2,
|
||||
None,
|
||||
'___sec47'),
|
||||
('Why resampling methods ?', 2, None, '___sec48'),
|
||||
('Statistical analysis', 2, None, '___sec49'),
|
||||
('Statistics', 2, None, '___sec50'),
|
||||
('Statistics, moments', 2, None, '___sec51'),
|
||||
('Statistics, central moments', 2, None, '___sec52'),
|
||||
('Statistics, covariance', 2, None, '___sec53'),
|
||||
('Statistics, more covariance', 2, None, '___sec54'),
|
||||
('Covariance example', 2, None, '___sec55'),
|
||||
('Covariance in numpy', 2, None, '___sec56'),
|
||||
('Statistics, independent variables', 2, None, '___sec57'),
|
||||
('Statistics, more variance', 2, None, '___sec58'),
|
||||
('Statistics and stochastic processes', 2, None, '___sec59'),
|
||||
('Statistics and sample variables', 2, None, '___sec60'),
|
||||
'___sec48'),
|
||||
('Why resampling methods ?', 2, None, '___sec49'),
|
||||
('Statistical analysis', 2, None, '___sec50'),
|
||||
('Statistics', 2, None, '___sec51'),
|
||||
('Statistics, moments', 2, None, '___sec52'),
|
||||
('Statistics, central moments', 2, None, '___sec53'),
|
||||
('Statistics, covariance', 2, None, '___sec54'),
|
||||
('Statistics, more covariance', 2, None, '___sec55'),
|
||||
('Covariance example', 2, None, '___sec56'),
|
||||
('Covariance in numpy', 2, None, '___sec57'),
|
||||
('Statistics, independent variables', 2, None, '___sec58'),
|
||||
('Statistics, more variance', 2, None, '___sec59'),
|
||||
('Statistics and stochastic processes', 2, None, '___sec60'),
|
||||
('Statistics and sample variables', 2, None, '___sec61'),
|
||||
('Statistics, sample variance and covariance',
|
||||
2,
|
||||
None,
|
||||
'___sec61'),
|
||||
('Statistics, law of large numbers', 2, None, '___sec62'),
|
||||
('Statistics, more on sample error', 2, None, '___sec63'),
|
||||
('Statistics', 2, None, '___sec64'),
|
||||
('Statistics, central limit theorem', 2, None, '___sec65'),
|
||||
('Statistics, more technicalities', 2, None, '___sec66'),
|
||||
('Statistics', 2, None, '___sec67'),
|
||||
('Statistics and sample variance', 2, None, '___sec68'),
|
||||
('Statistics, uncorrelated results', 2, None, '___sec69'),
|
||||
('Statistics, computations', 2, None, '___sec70'),
|
||||
'___sec62'),
|
||||
('Statistics, law of large numbers', 2, None, '___sec63'),
|
||||
('Statistics, more on sample error', 2, None, '___sec64'),
|
||||
('Statistics', 2, None, '___sec65'),
|
||||
('Statistics, central limit theorem', 2, None, '___sec66'),
|
||||
('Statistics, more technicalities', 2, None, '___sec67'),
|
||||
('Statistics', 2, None, '___sec68'),
|
||||
('Statistics and sample variance', 2, None, '___sec69'),
|
||||
('Statistics, uncorrelated results', 2, None, '___sec70'),
|
||||
('Statistics, computations', 2, None, '___sec71'),
|
||||
('Statistics, more on computations of errors',
|
||||
2,
|
||||
None,
|
||||
'___sec71'),
|
||||
('Statistics, wrapping up 1', 2, None, '___sec72'),
|
||||
('Statistics, final expression', 2, None, '___sec73'),
|
||||
'___sec72'),
|
||||
('Statistics, wrapping up 1', 2, None, '___sec73'),
|
||||
('Statistics, final expression', 2, None, '___sec74'),
|
||||
('Statistics, effective number of correlations',
|
||||
2,
|
||||
None,
|
||||
'___sec74'),
|
||||
'___sec75'),
|
||||
('Linking the regression analysis with a statistical '
|
||||
'interpretation',
|
||||
2,
|
||||
None,
|
||||
'___sec75'),
|
||||
('Assumptions made', 2, None, '___sec76'),
|
||||
('Expectation value and variance', 2, None, '___sec77'),
|
||||
'___sec76'),
|
||||
('Assumptions made', 2, None, '___sec77'),
|
||||
('Expectation value and variance', 2, None, '___sec78'),
|
||||
('Expectation value and variance for $\\boldsymbol{\\beta}$',
|
||||
2,
|
||||
None,
|
||||
'___sec78'),
|
||||
('Resampling methods', 2, None, '___sec79'),
|
||||
'___sec79'),
|
||||
('Resampling methods', 2, None, '___sec80'),
|
||||
('Resampling methods: Jackknife and Bootstrap',
|
||||
2,
|
||||
None,
|
||||
'___sec80'),
|
||||
('Resampling methods: Jackknife', 2, None, '___sec81'),
|
||||
('Jackknife code example', 2, None, '___sec82'),
|
||||
('Resampling methods: Bootstrap', 2, None, '___sec83'),
|
||||
('Resampling methods: Bootstrap background', 2, None, '___sec84'),
|
||||
'___sec81'),
|
||||
('Resampling methods: Jackknife', 2, None, '___sec82'),
|
||||
('Jackknife code example', 2, None, '___sec83'),
|
||||
('Resampling methods: Bootstrap', 2, None, '___sec84'),
|
||||
('Resampling methods: Bootstrap background', 2, None, '___sec85'),
|
||||
('Resampling methods: More Bootstrap background',
|
||||
2,
|
||||
None,
|
||||
'___sec85'),
|
||||
('Resampling methods: Bootstrap approach', 2, None, '___sec86'),
|
||||
('Resampling methods: Bootstrap steps', 2, None, '___sec87'),
|
||||
('Code example for the Bootstrap method', 2, None, '___sec88'),
|
||||
('Various steps in cross-validation', 2, None, '___sec89'),
|
||||
'___sec86'),
|
||||
('Resampling methods: Bootstrap approach', 2, None, '___sec87'),
|
||||
('Resampling methods: Bootstrap steps', 2, None, '___sec88'),
|
||||
('Code example for the Bootstrap method', 2, None, '___sec89'),
|
||||
('Various steps in cross-validation', 2, None, '___sec90'),
|
||||
('How to set up the cross-validation for Ridge and/or Lasso',
|
||||
2,
|
||||
None,
|
||||
'___sec90'),
|
||||
('Cross-validation in brief', 2, None, '___sec91'),
|
||||
'___sec91'),
|
||||
('Cross-validation in brief', 2, None, '___sec92'),
|
||||
('Code Example for Cross-validation and $k$-fold '
|
||||
'Cross-validation',
|
||||
2,
|
||||
None,
|
||||
'___sec92'),
|
||||
('The bias-variance tradeoff', 2, None, '___sec93'),
|
||||
('Example code for Bias-Variance tradeoff', 2, None, '___sec94'),
|
||||
('Understanding what happens', 2, None, '___sec95'),
|
||||
('Summing up', 2, None, '___sec96'),
|
||||
'___sec93'),
|
||||
('The bias-variance tradeoff', 2, None, '___sec94'),
|
||||
('Example code for Bias-Variance tradeoff', 2, None, '___sec95'),
|
||||
('Understanding what happens', 2, None, '___sec96'),
|
||||
('Summing up', 2, None, '___sec97'),
|
||||
("Another Example from Scikit-Learn's Repository",
|
||||
2,
|
||||
None,
|
||||
'___sec97'),
|
||||
'___sec98'),
|
||||
('More examples on bootstrap and cross-validation and errors',
|
||||
2,
|
||||
None,
|
||||
'___sec98'),
|
||||
'___sec99'),
|
||||
('The same example but now with cross-validation',
|
||||
2,
|
||||
None,
|
||||
'___sec99'),
|
||||
('Cross-validation with Ridge', 2, None, '___sec100'),
|
||||
('The Ising model', 2, None, '___sec101'),
|
||||
'___sec100'),
|
||||
('Cross-validation with Ridge', 2, None, '___sec101'),
|
||||
('The Ising model', 2, None, '___sec102'),
|
||||
('Reformulating the problem to suit regression',
|
||||
2,
|
||||
None,
|
||||
'___sec102'),
|
||||
('Linear regression', 2, None, '___sec103'),
|
||||
('Singular Value decomposition', 2, None, '___sec104'),
|
||||
('The one-dimensional Ising model', 2, None, '___sec105'),
|
||||
('Ridge regression', 2, None, '___sec106'),
|
||||
('LASSO regression', 2, None, '___sec107'),
|
||||
'___sec103'),
|
||||
('Linear regression', 2, None, '___sec104'),
|
||||
('Singular Value decomposition', 2, None, '___sec105'),
|
||||
('The one-dimensional Ising model', 2, None, '___sec106'),
|
||||
('Ridge regression', 2, None, '___sec107'),
|
||||
('LASSO regression', 2, None, '___sec108'),
|
||||
('Performance as function of the regularization parameter',
|
||||
2,
|
||||
None,
|
||||
'___sec108'),
|
||||
'___sec109'),
|
||||
('Finding the optimal value of $\\lambda$',
|
||||
2,
|
||||
None,
|
||||
'___sec109')]}
|
||||
'___sec110')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -281,116 +282,117 @@ MathJax.Hub.Config({
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs001.html#___sec0" style="font-size: 80%;">Why Linear Regression (aka Ordinary Least Squares and family)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs002.html#___sec1" style="font-size: 80%;">Regression analysis, overarching aims</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs003.html#___sec2" style="font-size: 80%;">Regression analysis, overarching aims II</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs004.html#___sec3" style="font-size: 80%;">Examples</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs005.html#___sec4" style="font-size: 80%;">General linear models</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs006.html#___sec5" style="font-size: 80%;">Rewriting the fitting procedure as a linear algebra problem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs007.html#___sec6" style="font-size: 80%;">Rewriting the fitting procedure as a linear algebra problem, more details</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs008.html#___sec7" style="font-size: 80%;">Generalizing the fitting procedure as a linear algebra problem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs001.html#___sec0" style="font-size: 80%;">To do list</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs002.html#___sec1" style="font-size: 80%;">Why Linear Regression (aka Ordinary Least Squares and family)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs003.html#___sec2" style="font-size: 80%;">Regression analysis, overarching aims</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs004.html#___sec3" style="font-size: 80%;">Regression analysis, overarching aims II</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs005.html#___sec4" style="font-size: 80%;">Examples</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs006.html#___sec5" style="font-size: 80%;">General linear models</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs007.html#___sec6" style="font-size: 80%;">Rewriting the fitting procedure as a linear algebra problem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs008.html#___sec7" style="font-size: 80%;">Rewriting the fitting procedure as a linear algebra problem, more details</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs009.html#___sec8" style="font-size: 80%;">Generalizing the fitting procedure as a linear algebra problem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs010.html#___sec9" style="font-size: 80%;">Optimizing our parameters</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs011.html#___sec10" style="font-size: 80%;">Our model for the nuclear binding energies</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs012.html#___sec11" style="font-size: 80%;">Optimizing our parameters, more details</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs013.html#___sec12" style="font-size: 80%;">Interpretations and optimizing our parameters</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs010.html#___sec9" style="font-size: 80%;">Generalizing the fitting procedure as a linear algebra problem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs011.html#___sec10" style="font-size: 80%;">Optimizing our parameters</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs012.html#___sec11" style="font-size: 80%;">Our model for the nuclear binding energies</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs013.html#___sec12" style="font-size: 80%;">Optimizing our parameters, more details</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs014.html#___sec13" style="font-size: 80%;">Interpretations and optimizing our parameters</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs015.html#___sec14" style="font-size: 80%;">Some useful matrix and vector expressions</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs016.html#___sec15" style="font-size: 80%;">Interpretations and optimizing our parameters</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs017.html#___sec16" style="font-size: 80%;">Own code for Ordinary Least Squares</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs018.html#___sec17" style="font-size: 80%;">Adding error analysis and training set up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs019.html#___sec18" style="font-size: 80%;">The \( \chi^2 \) function</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs015.html#___sec14" style="font-size: 80%;">Interpretations and optimizing our parameters</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs016.html#___sec15" style="font-size: 80%;">Some useful matrix and vector expressions</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs017.html#___sec16" style="font-size: 80%;">Interpretations and optimizing our parameters</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs018.html#___sec17" style="font-size: 80%;">Own code for Ordinary Least Squares</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs019.html#___sec18" style="font-size: 80%;">Adding error analysis and training set up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs020.html#___sec19" style="font-size: 80%;">The \( \chi^2 \) function</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs021.html#___sec20" style="font-size: 80%;">The \( \chi^2 \) function</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs022.html#___sec21" style="font-size: 80%;">The \( \chi^2 \) function</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs023.html#___sec22" style="font-size: 80%;">The \( \chi^2 \) function</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs024.html#___sec23" style="font-size: 80%;">The \( \chi^2 \) function</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs025.html#___sec24" style="font-size: 80%;">Fitting an Equation of State for Dense Nuclear Matter</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs026.html#___sec25" style="font-size: 80%;">The code</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs027.html#___sec26" style="font-size: 80%;">Splitting our Data in Training and Test data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec27" style="font-size: 80%;">The Boston housing data example</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs029.html#___sec28" style="font-size: 80%;">Housing data, the code</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs030.html#___sec29" style="font-size: 80%;">The singular value decomposition</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs031.html#___sec30" style="font-size: 80%;">Linear Regression Problems</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs032.html#___sec31" style="font-size: 80%;">Fixing the singularity</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs033.html#___sec32" style="font-size: 80%;">Basic math of the SVD</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs034.html#___sec33" style="font-size: 80%;">The SVD, a Fantastic Algorithm</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs035.html#___sec34" style="font-size: 80%;">Another Example</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs036.html#___sec35" style="font-size: 80%;">Economy-size SVD</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs037.html#___sec36" style="font-size: 80%;">Mathematical Properties</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs038.html#___sec37" style="font-size: 80%;">Ridge and LASSO Regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs039.html#___sec38" style="font-size: 80%;">More on Ridge Regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs040.html#___sec39" style="font-size: 80%;">Interpreting the Ridge results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs041.html#___sec40" style="font-size: 80%;">More interpretations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs042.html#___sec41" style="font-size: 80%;">Codes for the SVD</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs043.html#___sec42" style="font-size: 80%;">A better understanding of regularization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs044.html#___sec43" style="font-size: 80%;">Decomposing the OLS and Ridge expressions</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs045.html#___sec44" style="font-size: 80%;">Spectral Decomposition of the OLS</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs046.html#___sec45" style="font-size: 80%;">Where are we going?</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs047.html#___sec46" style="font-size: 80%;">Resampling methods</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs048.html#___sec47" style="font-size: 80%;">Resampling approaches can be computationally expensive</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs049.html#___sec48" style="font-size: 80%;">Why resampling methods ?</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs050.html#___sec49" style="font-size: 80%;">Statistical analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs051.html#___sec50" style="font-size: 80%;">Statistics</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs052.html#___sec51" style="font-size: 80%;">Statistics, moments</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs053.html#___sec52" style="font-size: 80%;">Statistics, central moments</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs054.html#___sec53" style="font-size: 80%;">Statistics, covariance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs055.html#___sec54" style="font-size: 80%;">Statistics, more covariance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs056.html#___sec55" style="font-size: 80%;">Covariance example</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs057.html#___sec56" style="font-size: 80%;">Covariance in numpy</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs058.html#___sec57" style="font-size: 80%;">Statistics, independent variables</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs059.html#___sec58" style="font-size: 80%;">Statistics, more variance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs060.html#___sec59" style="font-size: 80%;">Statistics and stochastic processes</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs061.html#___sec60" style="font-size: 80%;">Statistics and sample variables</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs062.html#___sec61" style="font-size: 80%;">Statistics, sample variance and covariance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs063.html#___sec62" style="font-size: 80%;">Statistics, law of large numbers</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs064.html#___sec63" style="font-size: 80%;">Statistics, more on sample error</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs065.html#___sec64" style="font-size: 80%;">Statistics</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs066.html#___sec65" style="font-size: 80%;">Statistics, central limit theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs067.html#___sec66" style="font-size: 80%;">Statistics, more technicalities</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs068.html#___sec67" style="font-size: 80%;">Statistics</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs069.html#___sec68" style="font-size: 80%;">Statistics and sample variance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs070.html#___sec69" style="font-size: 80%;">Statistics, uncorrelated results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs071.html#___sec70" style="font-size: 80%;">Statistics, computations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs072.html#___sec71" style="font-size: 80%;">Statistics, more on computations of errors</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs073.html#___sec72" style="font-size: 80%;">Statistics, wrapping up 1</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs074.html#___sec73" style="font-size: 80%;">Statistics, final expression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs075.html#___sec74" style="font-size: 80%;">Statistics, effective number of correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs076.html#___sec75" style="font-size: 80%;">Linking the regression analysis with a statistical interpretation</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs077.html#___sec76" style="font-size: 80%;">Assumptions made</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs078.html#___sec77" style="font-size: 80%;">Expectation value and variance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs079.html#___sec78" style="font-size: 80%;">Expectation value and variance for \( \boldsymbol{\beta} \)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs080.html#___sec79" style="font-size: 80%;">Resampling methods</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs081.html#___sec80" style="font-size: 80%;">Resampling methods: Jackknife and Bootstrap</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs082.html#___sec81" style="font-size: 80%;">Resampling methods: Jackknife</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs083.html#___sec82" style="font-size: 80%;">Jackknife code example</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs084.html#___sec83" style="font-size: 80%;">Resampling methods: Bootstrap</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs085.html#___sec84" style="font-size: 80%;">Resampling methods: Bootstrap background</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs086.html#___sec85" style="font-size: 80%;">Resampling methods: More Bootstrap background</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs087.html#___sec86" style="font-size: 80%;">Resampling methods: Bootstrap approach</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs088.html#___sec87" style="font-size: 80%;">Resampling methods: Bootstrap steps</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs089.html#___sec88" style="font-size: 80%;">Code example for the Bootstrap method</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs090.html#___sec89" style="font-size: 80%;">Various steps in cross-validation</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs091.html#___sec90" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs092.html#___sec91" style="font-size: 80%;">Cross-validation in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs093.html#___sec92" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs094.html#___sec93" style="font-size: 80%;">The bias-variance tradeoff</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs095.html#___sec94" style="font-size: 80%;">Example code for Bias-Variance tradeoff</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs096.html#___sec95" style="font-size: 80%;">Understanding what happens</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs097.html#___sec96" style="font-size: 80%;">Summing up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs098.html#___sec97" style="font-size: 80%;">Another Example from Scikit-Learn's Repository</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs099.html#___sec98" style="font-size: 80%;">More examples on bootstrap and cross-validation and errors</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs100.html#___sec99" style="font-size: 80%;">The same example but now with cross-validation</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs101.html#___sec100" style="font-size: 80%;">Cross-validation with Ridge</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs102.html#___sec101" style="font-size: 80%;">The Ising model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs103.html#___sec102" style="font-size: 80%;">Reformulating the problem to suit regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs104.html#___sec103" style="font-size: 80%;">Linear regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs105.html#___sec104" style="font-size: 80%;">Singular Value decomposition</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs106.html#___sec105" style="font-size: 80%;">The one-dimensional Ising model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs107.html#___sec106" style="font-size: 80%;">Ridge regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs108.html#___sec107" style="font-size: 80%;">LASSO regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs109.html#___sec108" style="font-size: 80%;">Performance as function of the regularization parameter</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs110.html#___sec109" style="font-size: 80%;">Finding the optimal value of \( \lambda \)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs025.html#___sec24" style="font-size: 80%;">The \( \chi^2 \) function</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs026.html#___sec25" style="font-size: 80%;">Fitting an Equation of State for Dense Nuclear Matter</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs027.html#___sec26" style="font-size: 80%;">The code</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec27" style="font-size: 80%;">Splitting our Data in Training and Test data</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs029.html#___sec28" style="font-size: 80%;">The Boston housing data example</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs030.html#___sec29" style="font-size: 80%;">Housing data, the code</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs031.html#___sec30" style="font-size: 80%;">The singular value decomposition</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs032.html#___sec31" style="font-size: 80%;">Linear Regression Problems</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs033.html#___sec32" style="font-size: 80%;">Fixing the singularity</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs034.html#___sec33" style="font-size: 80%;">Basic math of the SVD</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs035.html#___sec34" style="font-size: 80%;">The SVD, a Fantastic Algorithm</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs036.html#___sec35" style="font-size: 80%;">Another Example</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs037.html#___sec36" style="font-size: 80%;">Economy-size SVD</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs038.html#___sec37" style="font-size: 80%;">Mathematical Properties</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs039.html#___sec38" style="font-size: 80%;">Ridge and LASSO Regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs040.html#___sec39" style="font-size: 80%;">More on Ridge Regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs041.html#___sec40" style="font-size: 80%;">Interpreting the Ridge results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs042.html#___sec41" style="font-size: 80%;">More interpretations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs043.html#___sec42" style="font-size: 80%;">Codes for the SVD</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs044.html#___sec43" style="font-size: 80%;">A better understanding of regularization</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs045.html#___sec44" style="font-size: 80%;">Decomposing the OLS and Ridge expressions</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs046.html#___sec45" style="font-size: 80%;">Spectral Decomposition of the OLS</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs047.html#___sec46" style="font-size: 80%;">Where are we going?</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs048.html#___sec47" style="font-size: 80%;">Resampling methods</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs049.html#___sec48" style="font-size: 80%;">Resampling approaches can be computationally expensive</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs050.html#___sec49" style="font-size: 80%;">Why resampling methods ?</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs051.html#___sec50" style="font-size: 80%;">Statistical analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs052.html#___sec51" style="font-size: 80%;">Statistics</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs053.html#___sec52" style="font-size: 80%;">Statistics, moments</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs054.html#___sec53" style="font-size: 80%;">Statistics, central moments</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs055.html#___sec54" style="font-size: 80%;">Statistics, covariance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs056.html#___sec55" style="font-size: 80%;">Statistics, more covariance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs057.html#___sec56" style="font-size: 80%;">Covariance example</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs058.html#___sec57" style="font-size: 80%;">Covariance in numpy</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs059.html#___sec58" style="font-size: 80%;">Statistics, independent variables</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs060.html#___sec59" style="font-size: 80%;">Statistics, more variance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs061.html#___sec60" style="font-size: 80%;">Statistics and stochastic processes</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs062.html#___sec61" style="font-size: 80%;">Statistics and sample variables</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs063.html#___sec62" style="font-size: 80%;">Statistics, sample variance and covariance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs064.html#___sec63" style="font-size: 80%;">Statistics, law of large numbers</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs065.html#___sec64" style="font-size: 80%;">Statistics, more on sample error</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs066.html#___sec65" style="font-size: 80%;">Statistics</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs067.html#___sec66" style="font-size: 80%;">Statistics, central limit theorem</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs068.html#___sec67" style="font-size: 80%;">Statistics, more technicalities</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs069.html#___sec68" style="font-size: 80%;">Statistics</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs070.html#___sec69" style="font-size: 80%;">Statistics and sample variance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs071.html#___sec70" style="font-size: 80%;">Statistics, uncorrelated results</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs072.html#___sec71" style="font-size: 80%;">Statistics, computations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs073.html#___sec72" style="font-size: 80%;">Statistics, more on computations of errors</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs074.html#___sec73" style="font-size: 80%;">Statistics, wrapping up 1</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs075.html#___sec74" style="font-size: 80%;">Statistics, final expression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs076.html#___sec75" style="font-size: 80%;">Statistics, effective number of correlations</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs077.html#___sec76" style="font-size: 80%;">Linking the regression analysis with a statistical interpretation</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs078.html#___sec77" style="font-size: 80%;">Assumptions made</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs079.html#___sec78" style="font-size: 80%;">Expectation value and variance</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs080.html#___sec79" style="font-size: 80%;">Expectation value and variance for \( \boldsymbol{\beta} \)</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs081.html#___sec80" style="font-size: 80%;">Resampling methods</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs082.html#___sec81" style="font-size: 80%;">Resampling methods: Jackknife and Bootstrap</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs083.html#___sec82" style="font-size: 80%;">Resampling methods: Jackknife</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs084.html#___sec83" style="font-size: 80%;">Jackknife code example</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs085.html#___sec84" style="font-size: 80%;">Resampling methods: Bootstrap</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs086.html#___sec85" style="font-size: 80%;">Resampling methods: Bootstrap background</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs087.html#___sec86" style="font-size: 80%;">Resampling methods: More Bootstrap background</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs088.html#___sec87" style="font-size: 80%;">Resampling methods: Bootstrap approach</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs089.html#___sec88" style="font-size: 80%;">Resampling methods: Bootstrap steps</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs090.html#___sec89" style="font-size: 80%;">Code example for the Bootstrap method</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs091.html#___sec90" style="font-size: 80%;">Various steps in cross-validation</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs092.html#___sec91" style="font-size: 80%;">How to set up the cross-validation for Ridge and/or Lasso</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs093.html#___sec92" style="font-size: 80%;">Cross-validation in brief</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs094.html#___sec93" style="font-size: 80%;">Code Example for Cross-validation and \( k \)-fold Cross-validation</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs095.html#___sec94" style="font-size: 80%;">The bias-variance tradeoff</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs096.html#___sec95" style="font-size: 80%;">Example code for Bias-Variance tradeoff</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs097.html#___sec96" style="font-size: 80%;">Understanding what happens</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs098.html#___sec97" style="font-size: 80%;">Summing up</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs099.html#___sec98" style="font-size: 80%;">Another Example from Scikit-Learn's Repository</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs100.html#___sec99" style="font-size: 80%;">More examples on bootstrap and cross-validation and errors</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs101.html#___sec100" style="font-size: 80%;">The same example but now with cross-validation</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs102.html#___sec101" style="font-size: 80%;">Cross-validation with Ridge</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs103.html#___sec102" style="font-size: 80%;">The Ising model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs104.html#___sec103" style="font-size: 80%;">Reformulating the problem to suit regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs105.html#___sec104" style="font-size: 80%;">Linear regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs106.html#___sec105" style="font-size: 80%;">Singular Value decomposition</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs107.html#___sec106" style="font-size: 80%;">The one-dimensional Ising model</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs108.html#___sec107" style="font-size: 80%;">Ridge regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs109.html#___sec108" style="font-size: 80%;">LASSO regression</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs110.html#___sec109" style="font-size: 80%;">Performance as function of the regularization parameter</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._Regression-bs111.html#___sec110" style="font-size: 80%;">Finding the optimal value of \( \lambda \)</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
@@ -404,37 +406,91 @@ MathJax.Hub.Config({
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0028"></a>
|
||||
<!-- !split -->
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec27" class="anchor">The Boston housing data example </h2>
|
||||
<h2 id="___sec27" class="anchor">Splitting our Data in Training and Test data </h2>
|
||||
|
||||
<p>
|
||||
The Boston housing
|
||||
data set was originally a part of UCI Machine Learning Repository
|
||||
and has been removed now. The data set is now included in <b>Scikit-Learn</b>'s
|
||||
library. There are 506 samples and 13 feature (predictor) variables
|
||||
in this data set. The objective is to predict the value of prices of
|
||||
the house using the features (predictors) listed here.
|
||||
It is normal in essentially all Machine Learning studies to split the
|
||||
data in a training set and a test set (sometimes also an additional
|
||||
validation set). <b>Scikit-Learn</b> has an own function for this. There
|
||||
is no explicit recipe for how much data should be included as training
|
||||
data and say test data. An accepted rule of thumb is to use
|
||||
approximately \( 2/3 \) to \( 4/5 \) of the data as training data. We will
|
||||
postpone a discussion of this splitting to the end of these notes and
|
||||
our discussion of the so-called <b>bias-variance</b> tradeoff. Here we
|
||||
limit ourselves to repeat the above equation of state fitting example
|
||||
but now splitting the data into a training set and a test set.
|
||||
|
||||
<p>
|
||||
The features/predictors are
|
||||
|
||||
<ol>
|
||||
<li> CRIM: Per capita crime rate by town</li>
|
||||
<li> ZN: Proportion of residential land zoned for lots over 25000 square feet</li>
|
||||
<li> INDUS: Proportion of non-retail business acres per town</li>
|
||||
<li> CHAS: Charles River dummy variable (= 1 if tract bounds river; 0 otherwise)</li>
|
||||
<li> NOX: Nitric oxide concentration (parts per 10 million)</li>
|
||||
<li> RM: Average number of rooms per dwelling</li>
|
||||
<li> AGE: Proportion of owner-occupied units built prior to 1940</li>
|
||||
<li> DIS: Weighted distances to five Boston employment centers</li>
|
||||
<li> RAD: Index of accessibility to radial highways</li>
|
||||
<li> TAX: Full-value property tax rate per USD10000</li>
|
||||
<li> B: \( 1000(Bk - 0.63)^2 \), where \( Bk \) is the proportion of [people of African American descent] by town</li>
|
||||
<li> LSTAT: Percentage of lower status of the population</li>
|
||||
<li> MEDV: Median value of owner-occupied homes in USD 1000s</li>
|
||||
</ol>
|
||||
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
|
||||
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">os</span>
|
||||
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
|
||||
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">pandas</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">pd</span>
|
||||
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
|
||||
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">sklearn.model_selection</span> <span style="color: #008000; font-weight: bold">import</span> train_test_split
|
||||
<span style="color: #408080; font-style: italic"># Where to save the figures and data files</span>
|
||||
PROJECT_ROOT_DIR <span style="color: #666666">=</span> <span style="color: #BA2121">"Results"</span>
|
||||
FIGURE_ID <span style="color: #666666">=</span> <span style="color: #BA2121">"Results/FigureFiles"</span>
|
||||
DATA_ID <span style="color: #666666">=</span> <span style="color: #BA2121">"DataFiles/"</span>
|
||||
|
||||
<span style="color: #008000; font-weight: bold">if</span> <span style="color: #AA22FF; font-weight: bold">not</span> os<span style="color: #666666">.</span>path<span style="color: #666666">.</span>exists(PROJECT_ROOT_DIR):
|
||||
os<span style="color: #666666">.</span>mkdir(PROJECT_ROOT_DIR)
|
||||
|
||||
<span style="color: #008000; font-weight: bold">if</span> <span style="color: #AA22FF; font-weight: bold">not</span> os<span style="color: #666666">.</span>path<span style="color: #666666">.</span>exists(FIGURE_ID):
|
||||
os<span style="color: #666666">.</span>makedirs(FIGURE_ID)
|
||||
|
||||
<span style="color: #008000; font-weight: bold">if</span> <span style="color: #AA22FF; font-weight: bold">not</span> os<span style="color: #666666">.</span>path<span style="color: #666666">.</span>exists(DATA_ID):
|
||||
os<span style="color: #666666">.</span>makedirs(DATA_ID)
|
||||
|
||||
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">image_path</span>(fig_id):
|
||||
<span style="color: #008000; font-weight: bold">return</span> os<span style="color: #666666">.</span>path<span style="color: #666666">.</span>join(FIGURE_ID, fig_id)
|
||||
|
||||
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">data_path</span>(dat_id):
|
||||
<span style="color: #008000; font-weight: bold">return</span> os<span style="color: #666666">.</span>path<span style="color: #666666">.</span>join(DATA_ID, dat_id)
|
||||
|
||||
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">save_fig</span>(fig_id):
|
||||
plt<span style="color: #666666">.</span>savefig(image_path(fig_id) <span style="color: #666666">+</span> <span style="color: #BA2121">".png"</span>, <span style="color: #008000">format</span><span style="color: #666666">=</span><span style="color: #BA2121">'png'</span>)
|
||||
|
||||
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">R2</span>(y_data, y_model):
|
||||
<span style="color: #008000; font-weight: bold">return</span> <span style="color: #666666">1</span> <span style="color: #666666">-</span> np<span style="color: #666666">.</span>sum((y_data <span style="color: #666666">-</span> y_model) <span style="color: #666666">**</span> <span style="color: #666666">2</span>) <span style="color: #666666">/</span> np<span style="color: #666666">.</span>sum((y_data <span style="color: #666666">-</span> np<span style="color: #666666">.</span>mean(y_data)) <span style="color: #666666">**</span> <span style="color: #666666">2</span>)
|
||||
<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">MSE</span>(y_data,y_model):
|
||||
n <span style="color: #666666">=</span> np<span style="color: #666666">.</span>size(y_model)
|
||||
<span style="color: #008000; font-weight: bold">return</span> np<span style="color: #666666">.</span>sum((y_data<span style="color: #666666">-</span>y_model)<span style="color: #666666">**2</span>)<span style="color: #666666">/</span>n
|
||||
|
||||
infile <span style="color: #666666">=</span> <span style="color: #008000">open</span>(data_path(<span style="color: #BA2121">"EoS.csv"</span>),<span style="color: #BA2121">'r'</span>)
|
||||
|
||||
<span style="color: #408080; font-style: italic"># Read the EoS data as csv file and organized into two arrays with density and energies</span>
|
||||
EoS <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>read_csv(infile, names<span style="color: #666666">=</span>(<span style="color: #BA2121">'Density'</span>, <span style="color: #BA2121">'Energy'</span>))
|
||||
EoS[<span style="color: #BA2121">'Energy'</span>] <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>to_numeric(EoS[<span style="color: #BA2121">'Energy'</span>], errors<span style="color: #666666">=</span><span style="color: #BA2121">'coerce'</span>)
|
||||
EoS <span style="color: #666666">=</span> EoS<span style="color: #666666">.</span>dropna()
|
||||
Energies <span style="color: #666666">=</span> EoS[<span style="color: #BA2121">'Energy'</span>]
|
||||
Density <span style="color: #666666">=</span> EoS[<span style="color: #BA2121">'Density'</span>]
|
||||
<span style="color: #408080; font-style: italic"># The design matrix now as function of various polytrops</span>
|
||||
X <span style="color: #666666">=</span> np<span style="color: #666666">.</span>zeros((<span style="color: #008000">len</span>(Density),<span style="color: #666666">5</span>))
|
||||
X[:,<span style="color: #666666">0</span>] <span style="color: #666666">=</span> <span style="color: #666666">1</span>
|
||||
X[:,<span style="color: #666666">1</span>] <span style="color: #666666">=</span> Density<span style="color: #666666">**</span>(<span style="color: #666666">2.0/3.0</span>)
|
||||
X[:,<span style="color: #666666">2</span>] <span style="color: #666666">=</span> Density
|
||||
X[:,<span style="color: #666666">3</span>] <span style="color: #666666">=</span> Density<span style="color: #666666">**</span>(<span style="color: #666666">4.0/3.0</span>)
|
||||
X[:,<span style="color: #666666">4</span>] <span style="color: #666666">=</span> Density<span style="color: #666666">**</span>(<span style="color: #666666">5.0/3.0</span>)
|
||||
<span style="color: #408080; font-style: italic"># We split the data in test and training data</span>
|
||||
X_train, X_test, y_train, y_test <span style="color: #666666">=</span> train_test_split(X, Energies, test_size<span style="color: #666666">=0.2</span>)
|
||||
<span style="color: #408080; font-style: italic"># matrix inversion to find beta</span>
|
||||
beta <span style="color: #666666">=</span> np<span style="color: #666666">.</span>linalg<span style="color: #666666">.</span>inv(X_train<span style="color: #666666">.</span>T<span style="color: #666666">.</span>dot(X_train))<span style="color: #666666">.</span>dot(X_train<span style="color: #666666">.</span>T)<span style="color: #666666">.</span>dot(y_train)
|
||||
<span style="color: #408080; font-style: italic"># and then make the prediction</span>
|
||||
ytilde <span style="color: #666666">=</span> X_train <span style="color: #666666">@</span> beta
|
||||
<span style="color: #008000">print</span>(<span style="color: #BA2121">"Training R2"</span>)
|
||||
<span style="color: #008000">print</span>(R2(y_train,ytilde))
|
||||
<span style="color: #008000">print</span>(<span style="color: #BA2121">"Training MSE"</span>)
|
||||
<span style="color: #008000">print</span>(MSE(y_train,ytilde))
|
||||
ypredict <span style="color: #666666">=</span> X_test <span style="color: #666666">@</span> beta
|
||||
<span style="color: #008000">print</span>(<span style="color: #BA2121">"Test R2"</span>)
|
||||
<span style="color: #008000">print</span>(R2(y_test,ypredict))
|
||||
<span style="color: #008000">print</span>(<span style="color: #BA2121">"Test MSE"</span>)
|
||||
<span style="color: #008000">print</span>(MSE(y_test,ypredict))
|
||||
</pre></div>
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
@@ -460,7 +516,7 @@ The features/predictors are
|
||||
<li><a href="._Regression-bs036.html">37</a></li>
|
||||
<li><a href="._Regression-bs037.html">38</a></li>
|
||||
<li><a href="">...</a></li>
|
||||
<li><a href="._Regression-bs110.html">111</a></li>
|
||||
<li><a href="._Regression-bs111.html">112</a></li>
|
||||
<li><a href="._Regression-bs029.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
Reference in New Issue
Block a user