[R] SVM coefficients

Noah Silverman noah at smartmediacorp.com
Mon Aug 31 09:32:19 CEST 2009


Steve,

That doesn't work.

I just trained an SVM with 80 variables.
svm_model$coefs gives me  a list of 10,000 items.  My training set is 
30,000 examples of 80 variables, so I have no idea what the 10,000 items 
represent.

There should be some attribute that lists the "weights" for each of the 
80 variables.

--
Noah

On 8/30/09 7:47 PM, Steve Lianoglou wrote:
> Hi,
>
> On Sun, Aug 30, 2009 at 6:10 PM, Noah Silverman<noah at smartmediacorp.com>  wrote:
>    
>> Hello,
>>
>> I'm using the svm function from the e1071 package.
>>
>> It works well and gives me nice results.
>>
>> I'm very curious to see the actual coefficients calculated for each input
>> variable.  (Other packages, like RapidMiner, show you this automatically.)
>>
>> I've tried looking at attributes for the model and do see a "coefficients"
>> item, but printing it returns an NULL result.
>>      
> Hmm .. I don't see a "coefficients" attribute, but rather a "coefs"
> attribute, which I guess is what you're looking for (?)
>
> Run "example(svm)" to its end and type:
>
> R>  m$coefs
>               [,1]
>   [1,]  1.00884130
>   [2,]  1.27446460
>   [3,]  2.00000000
>   [4,] -1.00000000
>   [5,] -0.35480340
>   [6,] -0.74043692
>   [7,] -0.87635311
>   [8,] -0.04857869
>   [9,] -0.03721980
> [10,] -0.64696793
> [11,] -0.57894605
>
> HTH,
>
> -steve
>
>




More information about the R-help mailing list