OK.

I'd like to do a pull request to implement the coef_-based predict function.

Since coef_ is a property, it recomputes the coefficient vector every
time it's accessed. This means if predict uses self.coef_, it won't be
any faster.

I think I need to introduce a dirty bit that determines whether coef_
needs to be recomputed. It starts off as True, gets set to False
whenever coef_ executes, and gets set to True whenever self.fit is
called. Am I overlooking any other situations that should affect the
dirty bit?

BTW I think now there is no bug in coef_. My script earlier was
getting weird results due to broadcasting behavior I didn't expect,
since coef_ returns an ndarray of shape (1,1000) and I'd been
expecting (1000,). The unit test failed when I introduced new data
because the unit test had a hard-coded expected result.

On Thu, May 24, 2012 at 12:31 PM, Olivier Grisel
<[email protected]> wrote:
> 2012/5/24 Ian Goodfellow <[email protected]>:
>> A high-level question before I dive in: is libsvm meant to compute
>> coef_ for us or do we compute it ourselves? If this is a libsvm bug I
>> should be looking for a bug in libsvm.
>>
>> On Thu, May 24, 2012 at 11:47 AM, Alexandre Gramfort
>> <[email protected]> wrote:
>>> here is where to look for the bug:
>>>
>>> https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/svm/base.py#L543
>
> This link from Alexandre email answers exactly your question: coef_ is
> a property that is computed from the dual_coef_ attribute which is
> computed by libsvm in the fit method.
>
> --
> Olivier
> http://twitter.com/ogrisel - http://github.com/ogrisel
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to