Skip to content

Tag: python

How does the class_weight parameter in scikit-learn work?

I am having a lot of trouble understanding how the class_weight parameter in scikit-learn’s Logistic Regression operates. The Situation I want to use logistic regression to do binary classification on a very unbalanced data set. The classes are labelled 0 (negative) and 1 (positive) and the observed dat…

double click to open an ipython notebook

Related posts: Open an ipython notebook via double-click on osx How can I open Ipython notebook from double click? I always cd to the directory of the notebook, then type ipython notebook in the browser and then open it in the browser. This steps is very inconvenient. In windows, I remembered that I can chang…

Import SAS data file into python data frame

I’m working on a data set (PSID) that gives data in a SAS format (a .txt and another file containing instructions to interpret the data). I cannot find anything in Python to read this type of data. Does anyone know of a pre-existing module/script to read SAS data? Edit (added from a comment to an answer…

Python: Multiple try except blocks in one?

Is there a neat way to have multiply commands in the try block so that it basically tries every single line without stopping as soon as one command yields an error? Basically I want to replace this: with this: Defining a list so I could loop through the commands seems to be a bad solution Answer I’d say…

NLTK: Package Errors? punkt and pickle?

Basically, I have no idea why I’m getting this error. Just to have more than an image, here is a similar message in code format. As it is more recent, the answer of this thread has already been mentioned in the message: Answer Perform the following: Then when you receive a window popup, select punkt und…