Dear teacher, thank you for the least-squares article! However, .ipynb files are quite inconvenient to run from the command-line. While you may use jupiter or pycharm, a majority of people don't. It would be very helpful to include .py files along with the .ipynb files so those that use a text-editor and command-line won't have to go through the trouble of copy/pasting (so 90's) just to be able to work along through the problem. Further, the _{2,3,4}.ipynb files are not pretty-print json, so they are obfuscated for all practical purposes. (yes, we could parse it with jq, but that's beyond most substack readers) Think about your friendly Linux students :)
Thanks for the feedback, David. This is an issue I've thought about and run into over the years -- it's also related to people asking me to provide MATLAB and R code. I also get questions from people having local-install issues, library versions, etc. That's a large part of the reason I switched to Colab: It guarantees the same environment for everyone, and when my code breaks or becomes outdated, I only need to fix it once and it will work again for anyone using colab.
Specifically about .py files: I've done that for some of my courses (separately provide .ipynb and .py files), but I've found that it creates more confusion and more work. There are command-line operations to transform a notebook into a py.
But actually, since it's only a small number of files (one per post), my advice is to open the notebook in Colab or any other jupyter-like environment, and then Save As a .py file. I can confirm that the export works great in Colab, and I would guess it also works well in other IDEs.
Great observation, Dmitry. The design matrix does need to be full column-rank for the left-inverse method to work. A rank-deficient design matrix is called "multicollinearity" in statistics terminology, and usually due to a problem with the model setup.
On the other hand, it is possible to fit rank-deficient models though other algorithms like min-norm or gradient descent.
Dear teacher, thank you for the least-squares article! However, .ipynb files are quite inconvenient to run from the command-line. While you may use jupiter or pycharm, a majority of people don't. It would be very helpful to include .py files along with the .ipynb files so those that use a text-editor and command-line won't have to go through the trouble of copy/pasting (so 90's) just to be able to work along through the problem. Further, the _{2,3,4}.ipynb files are not pretty-print json, so they are obfuscated for all practical purposes. (yes, we could parse it with jq, but that's beyond most substack readers) Think about your friendly Linux students :)
Thanks for the feedback, David. This is an issue I've thought about and run into over the years -- it's also related to people asking me to provide MATLAB and R code. I also get questions from people having local-install issues, library versions, etc. That's a large part of the reason I switched to Colab: It guarantees the same environment for everyone, and when my code breaks or becomes outdated, I only need to fix it once and it will work again for anyone using colab.
Specifically about .py files: I've done that for some of my courses (separately provide .ipynb and .py files), but I've found that it creates more confusion and more work. There are command-line operations to transform a notebook into a py.
But actually, since it's only a small number of files (one per post), my advice is to open the notebook in Colab or any other jupyter-like environment, and then Save As a .py file. I can confirm that the export works great in Colab, and I would guess it also works well in other IDEs.
There is one constraint we have to meet det(X^T * T) != 0
Great observation, Dmitry. The design matrix does need to be full column-rank for the left-inverse method to work. A rank-deficient design matrix is called "multicollinearity" in statistics terminology, and usually due to a problem with the model setup.
On the other hand, it is possible to fit rank-deficient models though other algorithms like min-norm or gradient descent.