Questions tagged [svm]

Support vector machines (SVMs) are a set of related supervised learning methods that analyze data and recognize patterns, used for classification and regression analysis.

From Wikipedia:

Support vector machines (SVMs) are a set of related supervised learning methods that analyze data and recognize patterns, used for classification and regression analysis. The standard SVM takes a set of input data and predicts, for each given input, which of two possible classes the input is a member of, which makes the SVM a non-probabilistic binary linear classifier. Since an SVM is a classifier, then given a set of training examples, each marked as belonging to one of two categories, an SVM training algorithm builds a model that assigns new examples into one category or the other. Intuitively, an SVM model is a representation of the examples as points in space, mapped so that the examples of the separate categories are divided by a clear gap that is as wide as possible. New examples are then mapped into that same space and predicted to belong to a category based on which side of the gap they fall on.

4561 questions
1
vote
1 answer

Using SVM with different kernels as a last layer in CNN network

I'm trying to replace the last fully connected layer of a CNN network with SVM using pytorch in a multi-classification problem. I've done some research and it says, that I should just replace the nn.CrossEntropyLoss with nn.MultiMarginLoss. How does…
Mattt
  • 23
  • 6
1
vote
1 answer

Linear SVM is used for linearly separating the data which have two features

Can we use KNN and linear SVM classifier for training the model with data which contains 4 features and have 6 classification clusters? Because what i think that linear SVM and KNN are used for linearly separating the data which have two features…
1
vote
1 answer

TypeError: unsupported operand type(s) for -: 'module' and 'LinearSegmentedColormap'

import matplotlib.pyplot as plt import matplotlib as cmap from sklearn import datasets from sklearn import svm digits = datasets.load_digits() clf = svm.SVC(gamma=0.001, C=100) print(len(digits.data)) x, y = digits.data[:-1],…
stik
  • 15
  • 5
1
vote
2 answers

R: e1071 svm function - is it necessary to convert categorical to dummies?

I know svm model needs preprocessing that converts categorical variables into dummy variables. However, when I am using e1071's svm function to fit a model with unconverted data (see train and test), no error pops up. I am assuming the function…
Rachel Zhang
  • 562
  • 6
  • 20
1
vote
0 answers

How to add sample_weight into a scikit-learn estimator

I have recently developed a scikit-learn estimator (a classifier) and I am now wanting to add sample_weight to the estimator. The reason is so I could apply boosting (ie. Adaboost) to the estimator (as Adaboost requires sample_weight to be present…
Leockl
  • 1,906
  • 5
  • 18
  • 51
1
vote
0 answers

R One-Class SVM - Get Probabilistic outputs

I am trying to find away to derive probabilistic outputs when predicting from a one-class svm in R. I know this is not supported in libsvm and I also know this question has been asked before and here a couple of years ago on SO but packages were not…
A_Murphy
  • 184
  • 2
  • 14
1
vote
0 answers

SVM-handwriting-recognition-master

Good day everyone, I am currently working on a project to classify handwriting using SVM classifier, after downloading and resizing the dataset from NIST special database 19. on trying to train my model... I keep getting this error: File…
1
vote
1 answer

Python SVM Classifier - issues with input NaNs and data shape

I am trying to build a binary SVM classifier with ECG data to diagnose sleep apnea. With 16,000 odd inputs I'm performing wavelet transform, manually extracting HRV features and storing them in a feature list, and feeding this list into the…
1
vote
0 answers

Why am I getting 100% train accuracy with SVM in sentiment detection?

I am trying to create an automatic sentiment detector which is supposed to assign a sentiment (positive, negative, neutral, etc.) based on it's target context text. But somehow I am getting a training accuracy of 100%. I have been trying to figure…
1
vote
0 answers

Best hyperparameters from GridSearch give inverted results compared to the actual SMOreg prediction results

I am a beginner in Machine Learning, and I have a question regarding the results of Grid Search to find the best hyperparameters of C and gamma for SMOreg. I am doing Grid Search to find the best C and gamma that will give me the highest…
1
vote
0 answers

Not Access to Confusion Matrix in SVM.SVC.score Scikit-learn Python

I used the SVM.SVC function to classify. But when I wanted to calculate the weighted and unweighted average accuracy, I couldn't access the confusion matrix. Because svm.SVC.score only provides a classifier accuracy percentage. How can I calculate…
1
vote
1 answer

Error : The tuning parameter grid should have columns mtry, SVM Regression

I'm trying to tune an SVM regression model using the caret package. Below the code: control <- trainControl(method="cv", number=5) tunegrid <- expand.grid(.mtry=c(6:12), .ntree=c(500, 600, 700, 800, 900, 1000)) set.seed(2) custom <-…
AGH
  • 300
  • 3
  • 12
1
vote
1 answer

How to obtain F1, precision, recall and confusion matrix

the goal of my project is to predict the accuracy level of some textual descriptions. I made the vectors with FASTTEXT. TSV output: label lenght 1 0 1:43 2 0 1:10 3 0 1:8 4 0 1:110 5 1 1:105 6 0 1:446 Then I'm…
Pelide
  • 468
  • 1
  • 4
  • 19
1
vote
0 answers

Support Vector Machine is outputting two zeros in Confusion Matrix

I am working on an ML project to predict a particular boolean column. I am using SVM's in SKlearn. I have some features I am trying to use as my descriptive features. These features contain integers (label encoding) and have a max of three unique…
1
vote
1 answer

Passing 3D data for SVM training in scikit

I am trying to use data I collected from an experiment to create an SVM model using sci-kit. My input data is 3D array (example x below), with labels being boolean labels (example y). X = [[[00, 00], [01,…
Gocool
  • 13
  • 1
  • 3