classification
Scikit-learn: How to obtain True Positive, True Negative, False Positive and False Negative
For the multi-class case, everything you need can be found from the confusion matrix. For example, if your confusion matrix looks like this: Then what you’re looking for, per class, can be found like this: Using pandas/numpy, you can do this for all classes at once like so: FP = confusion_matrix.sum(axis=0) – np.diag(confusion_matrix) FN = … Read more
Loss function for class imbalanced binary classifier in Tensor flow
You can add class weights to the loss function, by multiplying logits. Regular cross entropy loss is this: loss(x, class) = -log(exp(x[class]) / (\sum_j exp(x[j]))) = -x[class] + log(\sum_j exp(x[j])) in weighted case: loss(x, class) = weights[class] * -x[class] + log(\sum_j exp(weights[class] * x[j])) So by multiplying logits, you are re-scaling predictions of each class … Read more
memory issues when transforming np.array using to_categorical
You don’t need to use to_categorical since I guess you are doing multi-label classification. To avoid any confusion once and for all(!), let me explain this. If you are doing binary classification, meaning each sample may belong to only one of two classes e.g. cat vs dog or happy vs sad or positive review vs … Read more
association owned by classifier and association owned by relationship in UML
Chriss I hope this simple example helps. Guess you have a Java class public class A { private B b; … } In UML you would model this relationship as an association from A to B: A -> B with the following modeling elements: Class B Class A + Property b : B [0..1] (owned … Read more
Retraining after Cross Validation with libsvm
The -v option here is really meant to be used as a way to avoid the overfitting problem (instead of using the whole data for training, perform an N-fold cross-validation training on N-1 folds and testing on the remaining fold, one at-a-time, then report the average accuracy). Thus it only returns the cross-validation accuracy (assuming … Read more
A simple explanation of Naive Bayes Classification [closed]
The accepted answer has many elements of k-NN (k-nearest neighbors), a different algorithm. Both k-NN and NaiveBayes are classification algorithms. Conceptually, k-NN uses the idea of “nearness” to classify new entities. In k-NN ‘nearness’ is modeled with ideas such as Euclidean Distance or Cosine Distance. By contrast, in NaiveBayes, the concept of ‘probability’ is used … Read more
support vector machines in matlab
SVMs were originally designed for binary classification. They have then been extended to handle multi-class problems. The idea is to decompose the problem into many binary-class problems and then combine them to obtain the prediction. One approach called one-against-all, builds as many binary classifiers as there are classes, each trained to separate one class from … Read more
Multi-class classification in libsvm [closed]
According to the official libsvm documentation (Section 7): LIBSVM implements the “one-against-one” approach for multi-class classification. If k is the number of classes, then k(k-1)/2 classifiers are constructed and each one trains data from two classes. In classification we use a voting strategy: each binary classification is considered to be a voting where votes can … Read more
Cost function training target versus accuracy desired goal
How can we train a neural network so that it ends up maximizing classification accuracy? I’m asking for a way to get a continuous proxy function that’s closer to the accuracy To start with, the loss function used today for classification tasks in (deep) neural nets was not invented with them, but it goes back … Read more