SVM uses a distance measure in the algorithm,
What is the default distance measurement used in sklearn SVM ?
Is it possible to change it ?
SVM is minimizing the [Hinge loss][1]. You cannot change the loss otherwise this is not an SVM anymore (e.g. log loss will give rise to logistic regression). However, you can make use of kernels via the kernel tricks (look a the kernel parameters in sklearn.svm.SVC)
If you want an estimator for which you can change the loss, you can use sklearn.linear_model.SGDClassifier.
Related
Which metrics is better for multi-label classification in Keras: accuracy or categorical_accuracy? Obviously the last activation function is sigmoid and as loss function is binary_crossentropy in this case.
I would not use Accuracy for classification tasks with unbalanced classes.
Especially for multi-label tasks, you probably have most of your labels to be False. That is, each data point can only have a small set of labels compared to the cardinality of all of the possibile labels.
For that reason accuracy is not a good metric, if your model predict all False (sigmoid activation output < 0.5) then you would measure a very high accuracy.
I would analyze either the AUC or recall/precision at each epoch.
Alternatively a multi-label task can be seen as a ranking task (like Recommender Systems) and you could evaluate precision#k or recall#k where k are the top predicted labels.
If your Keras back-end is TensorFlow, check out the full list of supported metrics here: https://www.tensorflow.org/api_docs/python/tf/keras/metrics.
Actually, there is no metric named accuracy in Keras. When you set metrics=['accuray'] in Keras, the correct accuracy metric will be inferred automatically based on the loss function used. As a result, since you have used binary_crossentropy as the loss function, the binary_accuracy will be chosen as the metric.
Now, you should definitely choose binary_accuracy over categorical_accuracy in a multi-label classification task since classes are independent from each other and the prediction for each class should be considered independently of the predictions for other classes.
My aim is to classify an impulsive audio signal as whether it is a gunshot or not a gunshot.
I am trying to detect the gunshot event in MATLAB using svmtrain and svmclassify functions. To evaluate the accuracy of classification, the balloon burst and clapping signal are used as different classes. While accuracy of differnetiating between gunshot and either of the two classes is good, the differentiation between gunshot and combined baloon+clap signal is poor.
Please guide how may I use SVM to classify between gunshot and non-gunshot signals?
If SVM is not a good classifier what else may I try to achieve the goal
Solution-1: Classification after implementing RBF Kernel in svmclassify().
Solution-2: Classification score using predict()
Simply apply non-linear SVM to discriminate between these classes. RBF kernel should do the trick.
I'm using Pybrain to train a recurrent neural network. However, the average of the weights keeps climbing and after several iterations the train and test accuracy become lower. Now the highest performance on train data is about 55% and on test data is about 50%.
I think maybe the rnn have some training problems because of its high weights. How can I solve it? Thank you in advance.
The usual way to restrict the network parameters is to use a constrained error-functional which somehow penalizes the absolute magnitude of the parameters. Such is done in "weight decay" where you add to your sum-of-squares error the norm of the weights ||w||. Usually this is the Euclidian norm, but sometimes also the 1-norm in which case it is called "Lasso". Note that weight decay is also called ridge regression or Tikhonov regularization.
In PyBrain, according to this page in the documentation, there is available a Lasso-version of weight decay, which can be parametrized by the parameter wDecay.
I tried to use a neural network to predict some data. I used the
MATLAB neural network fitting toolbox and I could predict some tests.
But the problem is the accuracy is not good enough for my results.
I tried to change the neuron numbers to change accuracy, but it was not good.
I wanted to change the trainer function, but I didn't find anything.
For example, I want to command MATLAB's toolbox to try to train until the accuracy is less than 0.1.
What should I do?
You can set net.trainParam.goal to set the performance goal or increase net.trainParam.epochs to increase the maximum number of epochs to train.
What is the exact difference between a Support Vector Machine classifier and a Support Vector Machine regresssion machine?
The one sentence answer is that SVM classifier performs binary classification and SVM regression performs regression.
While performing very different tasks, they are both characterized by following points.
usage of kernels
absence of local minima
sparseness of the solution
capacity control obtained by acting on the margin
number of support vectors, etc.
For SVM classification the hinge loss is used, for SVM regression the epsilon insensitive loss function is used.
SVM classification is more widely used and in my opinion better understood than SVM regression.