typos and cleaning up week39
This commit is contained in:
@@ -78,7 +78,7 @@ plt.show()
|
||||
|
||||
!ec
|
||||
|
||||
Here we have performed a rather data greedy calculation as function of the regularization parameter $\lambda$. There is no resampling here. The latter can easily be added by employing the function _RidgeCV_ instead of just calling the _Ridge_ function. For _RidgeCV_ we need to passe the array of $\lambda$ values.
|
||||
Here we have performed a rather data greedy calculation as function of the regularization parameter $\lambda$. There is no resampling here. The latter can easily be added by employing the function _RidgeCV_ instead of just calling the _Ridge_ function. For _RidgeCV_ we need to pass the array of $\lambda$ values.
|
||||
By inspecting the figure we can in turn determine which is the optimal regularization parameter.
|
||||
This becomes however less functional in the long run.
|
||||
|
||||
@@ -137,7 +137,10 @@ print(f"R2 score: {R2(y_test,ypredictRidge)}")
|
||||
|
||||
!ec
|
||||
|
||||
By default the grid search function includes cross validation with five folds. The "Scikit-Learn documentation":"https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV" contains more information on how to set the different parameters.
|
||||
By default the grid search function includes cross validation with
|
||||
five folds. The "Scikit-Learn
|
||||
documentation":"https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html#sklearn.model_selection.GridSearchCV"
|
||||
contains more information on how to set the different parameters.
|
||||
|
||||
If we take out the random noise, running the above codes results in $\lambda=0$ yielding the best fit.
|
||||
|
||||
@@ -149,8 +152,10 @@ An alternative to the above manual grid set up, is to use a random
|
||||
search where the parameters are tuned from a random distribution
|
||||
(uniform below) for a fixed number of iterations. A model is
|
||||
constructed and evaluated for each combination of chosen parameters.
|
||||
We repeat the previous example but now with a random search.
|
||||
|
||||
We repeat the previous example but now with a random search. Note
|
||||
that values of $\lambda$ are now limited to be within $x\in
|
||||
[0,1]$. This domain may not be the most relevant one for the specific
|
||||
case under study.
|
||||
|
||||
|
||||
!bc pycod
|
||||
@@ -258,6 +263,16 @@ $p(y_i\vert x_i,\bm{\beta})(1-p(y_i\vert x_i,\bm{\beta})$, we can obtain a compa
|
||||
!et
|
||||
This defines what is called the Hessian matrix.
|
||||
|
||||
|
||||
!split
|
||||
===== To be added =====
|
||||
|
||||
We will add here an example which computes the likelihood $p_i$, sets up the gradient and the Hessian matrix.
|
||||
|
||||
Make link with linear regression and the Hessian matrix from linear regression.
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== Solving using Newton-Raphson's method =====
|
||||
|
||||
|
||||
Reference in New Issue
Block a user