title: Linear SVM and extracting the weights
body: <p>I am practicing SVM in R using the iris dataset and I want to get the feature weights/coefficients from my model, but I think I may have misinterpreted something given that my output gives me 32 support vectors. I was under the assumption I would get four given I have four variables being analyzed. I know there is a way to do it when using the <code>svm()</code> function, but I am trying to use the <code>train()</code> function from caret to produce my SVM. </p>
  
  <pre><code>library(caret)
  
  # Define fitControl
  fitControl &lt;- trainControl(## 5-fold CV
                method = "cv",
                number = 5,
                classProbs = TRUE,
                summaryFunction = twoClassSummary )
  
  # Define Tune
  grid&lt;-expand.grid(C=c(2^-5,2^-3,2^-1))
  
  ########## 
  df&lt;-iris head(df)
  df&lt;-df[df$Species!='setosa',]
  df$Species&lt;-as.character(df$Species)
  df$Species&lt;-as.factor(df$Species)
  
  # set random seed and run the model
  set.seed(321)
  svmFit1 &lt;- train(x = df[-5],
                   y=df$Species,
                   method = "svmLinear", 
                   trControl = fitControl,
                   preProc = c("center","scale"),
                   metric="ROC",
                   tuneGrid=grid )
  svmFit1
  </code></pre>
  
  <p>I thought it was simply <code>svmFit1$finalModel@coef</code>but I get 32 vectors when I believe I should get 4. Why is that?</p>