[R] SVM coefficients
Achim.Zeileis at wu-wien.ac.at
Mon Aug 31 09:54:06 CEST 2009
On Mon, 31 Aug 2009, Noah Silverman wrote:
> 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.
Presumably, the coefficients of the support vectors times the training
labels, see help("svm", package = "e1071"). See also
for some background information and the different formulations available.
> There should be some attribute that lists the "weights" for each of the 80
Not sure what you are looking for. Maybe David, the author auf svm() (and
now Cc), can help.
> On 8/30/09 7:47 PM, Steve Lianoglou wrote:
>> On Sun, Aug 30, 2009 at 6:10 PM, Noah Silverman<noah at smartmediacorp.com>
>>> 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.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
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help