Re: [Scikit-learn-general] Textbook advice

2012-07-18 Thread Gael Varoquaux
On Thu, Jul 19, 2012 at 12:42:25AM +0200, federico vaggi wrote: > I was looking for suggestions for a good ML textbook - ideally one that has > a heavy emphasis on applications and is based on Python. I don't know personally any that is based on Python. My favorite machine learning book is 'The El

Re: [Scikit-learn-general] LinearRegression() doesn't work

2012-07-18 Thread Gael Varoquaux
On Wed, Jul 18, 2012 at 05:50:16PM -0400, Zach Bastick wrote: > But this doesn't: > clf.fit([[0, 0, 0], [1, 1, 1]], [0, 1]) Works for me. I don't understand what excatly is your problem. Gael -- Live Security Virtual Co

[Scikit-learn-general] Unable to call fit() on random forest classifier when it is encapsulated in separate class

2012-07-18 Thread Shankar Satish
Hello everyone, I have a custom prediction class which in fact consists of a random forest regressor+classifier. The class implements a fit() method, which in turn calls the fit() methods of the classifier and regressor. Here is the code for my class: http://paste.org/51862 When i use the class a

[Scikit-learn-general] Textbook advice

2012-07-18 Thread federico vaggi
Hi everyone, I was looking for suggestions for a good ML textbook - ideally one that has a heavy emphasis on applications and is based on Python. I have heard mixed reviews of: http://www.amazon.com/Machine-Learning-Algorithmic-Perspective-Recognition/dp/1420067184 and I was told that for pure th

Re: [Scikit-learn-general] LinearRegression() doesn't work

2012-07-18 Thread Zach Bastick
Jake, I'm using 0.11 Another example is that this works: clf.fit([[0, 0], [1, 1]], [0, 1]) But this doesn't: clf.fit([[0, 0, 0], [1, 1, 1]], [0, 1]) I'm not sure whether this is related, but I installed Pyth yesterday.. http://pypi.python.org/pypi/pyth/ Zach On 18/07/2012 17:41, Jake Vanderpl

Re: [Scikit-learn-general] LinearRegression() doesn't work

2012-07-18 Thread Jake Vanderplas
Zach, For your second snippet, I get this output using the dev version of scikit-learn: coef array [ 0. 0. 0.] length 3 getting value 0: 0. getting value 1: 0. What version of scikit-learn are you using? You can find out by runni

[Scikit-learn-general] LinearRegression() doesn't work

2012-07-18 Thread Zach Bastick
I'm having trouble with linear_model.LinearRegression() This works: from sklearn import linear_model clf = linear_model.LinearRegression() clf.fit ([[0, 0, 0], [1, 1, 1], [2, 2, 2]], [0, 1, 2]) # clf.fit([[394, 3878, 13, 4, 0, 0],[384, 10175, 14, 4, 0, 0]],[3,9]) print 'coef array',clf.coef_ prin

Re: [Scikit-learn-general] SVM and ValueError: numpy.dtype has the wrong size, try recompiling

2012-07-18 Thread David Montgomery
That worked! I had a relatively clean install so removing did not cause damage. Thanks On Thu, Jul 19, 2012 at 3:16 AM, Jake Vanderplas wrote: > Hi David, > This sort of error generally is due to having multiple copies of numpy > on your system. One is being used during compilation, and anothe

Re: [Scikit-learn-general] SVM and ValueError: numpy.dtype has the wrong size, try recompiling

2012-07-18 Thread Gael Varoquaux
On Wed, Jul 18, 2012 at 12:16:57PM -0700, Jake Vanderplas wrote: >apt-get uninstall python-numpy python-scipy > and then install numpy and scipy through easy_install. You probably cannot realistically do that, as numpy is used by fairly core libraries of the system (python-gtk for instance, I

Re: [Scikit-learn-general] SVM and ValueError: numpy.dtype has the wrong size, try recompiling

2012-07-18 Thread Jake Vanderplas
Hi David, This sort of error generally is due to having multiple copies of numpy on your system. One is being used during compilation, and another incompatible one is being used by your python interpreter. I would do apt-get uninstall python-numpy python-scipy and then install numpy and scipy

[Scikit-learn-general] SVM and ValueError: numpy.dtype has the wrong size, try recompiling

2012-07-18 Thread David Montgomery
Hi, I am on ubuntu 10.04 I installed apt-get install python-numpy python-scipy easy_install scikit-learn When I import the followig, I get the below error. How do I resolve? from sklearn import svm Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] on linux2 Type "help", "copyright

Re: [Scikit-learn-general] Incorporation of extra training examples

2012-07-18 Thread Lars Buitinck
2012/7/18 Peter Prettenhofer : > 2012/7/18 Philipp Singer : >> Yes, I am currently trying around with tf only, but the vocabulary is >> still dependen on the corpus. > > I would fit the vectorizor on both datasets (such that the vocabulary > covers the union) and then fit the IDF transformers on ea

Re: [Scikit-learn-general] Incorporation of extra training examples

2012-07-18 Thread Peter Prettenhofer
2012/7/18 Philipp Singer : > Am 18.07.2012 15:32, schrieb Peter Prettenhofer: In this case I would fit one MultinomialNB for the foreground model and one for the background model. But how would I do the feature extraction (I have text documents) in this case? Would I fit (e.g., tfidf

Re: [Scikit-learn-general] Incorporation of extra training examples

2012-07-18 Thread Philipp Singer
Am 18.07.2012 15:32, schrieb Peter Prettenhofer: >>> In this case I would fit one MultinomialNB for the foreground model and >>> one for the background model. But how would I do the feature extraction >>> (I have text documents) in this case? Would I fit (e.g., tfidf) on the >>> whole corpus (foreg

Re: [Scikit-learn-general] Incorporation of extra training examples

2012-07-18 Thread Peter Prettenhofer
>> In this case I would fit one MultinomialNB for the foreground model and >> one for the background model. But how would I do the feature extraction >> (I have text documents) in this case? Would I fit (e.g., tfidf) on the >> whole corpus (foreground + background) and then transform both datasets

Re: [Scikit-learn-general] Incorporation of extra training examples

2012-07-18 Thread Olivier Grisel
2012/7/18 Philipp Singer : > Am 09.07.2012 14:44, schrieb Peter Prettenhofer: >> 2012/7/9 Philipp Singer : >>> Am 09.07.2012 13:47, schrieb Peter Prettenhofer: Hi, >>> >>> Hey! some quick thoughts: - if you use a multinomial Naive Bayes classifier (aka a language model

Re: [Scikit-learn-general] Incorporation of extra training examples

2012-07-18 Thread Philipp Singer
Am 09.07.2012 14:44, schrieb Peter Prettenhofer: > 2012/7/9 Philipp Singer : >> Am 09.07.2012 13:47, schrieb Peter Prettenhofer: >>> Hi, >> >> Hey! >>> >>> some quick thoughts: >>> >>> - if you use a multinomial Naive Bayes classifier (aka a language >>> model) you can fit a background model on the

Re: [Scikit-learn-general] silhouette score returning NaN

2012-07-18 Thread Olivier Grisel
2012/7/17 Rafael Almeida : > Hello, > > I'm experimenting with k-means clustering. When using certain values for k, > silhouette score returns NaN. Is that a bug or is that how it's supposed to > work? What does it mean? If it is not a bug, I think the function should > return something more meanin

[Scikit-learn-general] silhouette score returning NaN

2012-07-18 Thread Rafael Almeida
Hello, I'm experimenting with k-means clustering. When using certain values for k, silhouette score returns NaN. Is that a bug or is that how it's supposed to work? What does it mean? If it is not a bug, I think the function should return something more meaningful when it fails. []'s Rafael---