Quantcast
Channel: Machine Learning
Viewing all articles
Browse latest Browse all 63515

Need a Python assist (ipython, pandas, patsy, statsmodel.api)

$
0
0

I was following along on a tutorial, trying to apply the steps to my own project, and ran into a problem.. I'm getting an error from statsmodel.api (LinAlg: Singular Matrix)..

Basically I'm reading in data to a Pandas df, building some new feature columns, then using patsy to turn it into a friendly df for eventual use with skearln and other packages.

Then I build the formula, and try and fit a Logit regression model and I get my singular matrix error, and I'm not really sure why.

You can view the .ipynb here..

http://nbviewer.ipython.org/github/namebrandon/HIV/blob/Dev/Encoding%20AA%20Frequency%20-%20New%20Feature%20Columns.ipynb

The only difference I can see in my version as compared with the tutorial is I'm not using any categorical variables (should all be continuous and numeric..) and some of my columns are all zeroes.

FWIW, the tutorial I'm following is here.. particularly cells 17 & 18 are where I'm hitting the roadblock..

https://www.wakari.io/sharing/bundle/travis/Titanic?has_login=False

I'm sure I'm doing something stupid, but I'm trying to use this project to learn machine learning in Python, so I don't have much knowledge depth in this particular area to rely on.

Any help is mucho appreciated.

submitted by nameBrandon
[link][2 comments]

Viewing all articles
Browse latest Browse all 63515

Trending Articles