GriffinAustin / pynance

Lightweight Python library for assembling and analysing financial data
MIT License
317 stars 43 forks source link

linear regression support #13

Closed aisthesis closed 8 years ago

aisthesis commented 8 years ago

Add support for regularized linear regression. Cf. http://stackoverflow.com/questions/27476933/numpy-linear-regression-with-regularization

This would be a nice shortcut even though we don't want to support more complex machine learning algorithms.

aisthesis commented 8 years ago

http://openclassroom.stanford.edu/MainFolder/DocumentPage.php?course=MachineLearning&doc=exercises/ex5/ex5.html

Note that the regularization formula changes depending on whether or not the constant feature is present. If there is a constant feature, you need to write a 0 at [0, 0] in the identity matrix. Otherwise, you can use the identity matrix with no changes.

arkadasgupta commented 8 years ago

have you started work on this?

aisthesis commented 8 years ago

yes. I'm having trouble getting test data to verify that I have the correct equation, though.

https://github.com/aisthesis/pynance/blob/linreg/pynance/learn/linreg.py

I think the formula is right, but I can't find adequate unit tests for non-zero regularization.