probml / pmtk3

Probabilistic Modeling Toolkit for Matlab/Octave.
MIT License
1.55k stars 797 forks source link

Linear regression #76

Closed jbencook closed 10 years ago

jbencook commented 10 years ago

Added linregPolyVsDegree.py from chapter 1 and some utility functions

findmyway commented 10 years ago

Really good :~)

I had tried to write this example but failed.

there are some data preprocessing functions in sklearn.preprocessing http://scikit-learn.org/stable/modules/classes.html#module-sklearn.preprocessing maybe they are more flexible than you write in utils.py

jbencook commented 10 years ago

Yeah, I chose to stick as closely as possible to the PMTK matlab code instead of writing everything in a perfectly pythonic manner. The two main reasons I did this are:

  1. Being explicit about pre-processing facilitates the education function that this repository serves.
  2. I assumed that porting what has already been done in the matlab code will make our lives easier down the road. So, for example, when a matlab script calls centerCols(), a python developer can simply call center_cols() instead of figuring out which sklearn function to use.

That said, I'm happy to refactor in order to take advantage of sklearn if people think that's best.

findmyway commented 10 years ago

Agree~~~