how to export trained vectors to SVM in opencv - opencv

I am new to opencv. I want to use SVM in opencv. My question is can I train the classifier once and save all vectors. So in my main program I just need to import these vectors and do the classification. I read the SVM document and I only find get_support_vector function to get all vectors but I didn't find set_support_vector function. Does anybody have idea how to re-use a trained classifier? Thanks.

Related

What Does tf.estimator.LinearClassifier() Do?

In TensorFlow library, what does the tf.estimator.LinearClassifier class do in linear regression models? (In other words, what is it used for?)
Linear Classifier is nothing but Logistic Regression.
According to Tensorflow documentation, tf.estimator.LinearClassifier is used to
Train a linear model to classify instances into one of multiple
possible classes. When number of possible classes is 2, this is binary
classification
Linear regression predicts a value while the linear classifier predicts a class. Classification aims at predicting the probability of each class given a set of inputs.
For implementation of tf.estimator.LinearClassifier, please follow this tutorial by guru99.
To know about the linear classifiers, read this article.

How to perform incremental training of large data set using (scikit) Adaboost classifier?

I have a large size of the training dataset, so in order to fit it into the AdaBoost classifier, I would like to do incremental training.
Like in xgb we have a parameter called xgb_model to use the trained xgb model for further fitting the new data, I am looking for such parameters in AdaBoost classifier.
Currently, I have am trying to use fit function to iteratively train the model but it seems my classifier is not using the previous weights. How can I solve this?
It's not possible out-of-the-box. sklearn supports incremental/online training in some estimators, but not AdaBoostClassifier.
The estimators that support incremental training are listed here and have a special method named partial_fit().
see gaenari
it is c++ incremental decision tree.
support:
insert(csv), update(), and rebuild().
report()

scikit-learn classification using doc2vec representation

I want to classify text documents using doc2vec representation and scikit-learn models.
My problem is that I'm lost on how to get started. can someone explain the general steps usually taken to use doc2vec with scikit-learn?
There is a great tutorial here for a binary classification with scikit-learn + doc2vec. In short:
Using gensim to train/load your doc2vec model.
Input text will be converted to a fixed dimension vector of floats (the same dimension as your embedding). These are the actual input features.
Now feel free to use any classifier in scikit-learn.

How do I update a trained model (weka.classifiers.functions.MultilayerPerceptron) with new training data in Weka?

I would like to load a model I trained before and then update this model with new training data. But I found this task hard to accomplish.
I have learnt from Weka Wiki that
Classifiers implementing the weka.classifiers.UpdateableClassifier interface can be trained incrementally.
However, the regression model I trained is using weka.classifiers.functions.MultilayerPerceptron classifier which does not implement UpdateableClassifier.
Then I checked the Weka API and it turns out that no regression classifier implements UpdateableClassifier.
How can I train a regression model in Weka, and then update the model later with new training data after loading the model?
I have some data mining experience in Weka as well as in scikit-learn and r and updateble regression models do not exist in weka and scikit-learn as far as I know. Some R libraries however do support updating regression models (take a look at this linear regression model for example: http://stat.ethz.ch/R-manual/R-devel/library/stats/html/update.html), so if you are free to switching data mining tool this might help you out.
If you need to stick to Weka than I'm afraid that you would probably need to implement such a model yourself, but since I'm not a complete Weka expert please check with the guys at weka list (http://weka.wikispaces.com/Weka+Mailing+List).
The SGD classifier implementation in Weka supports multiple loss functions. Among them are two loss functions that are meant for linear regression, viz. Epsilon insensitive, and Huber loss functions.
Therefore one can use a linear regression trained with SGD as long as either of these two loss functions are used to minimize training error.

how to use libsvm model file in opencv

I am developing an OCR using SVM in opencv C++. SVM used is (one vs one multi-class) linear SVM. Opencv svm (multi-class)doesn't give probability estimates for each class that was used in time of training. So i tried my luck with libsvm Multi-class classification (and probability output) via error-correcting codes. It gave me the probability estimates for each of the class, now I want to use the training model file in opencv C++. I get an error. Now my problem is how to use the training model in opencv, if not possible how to get probability estimates for each of the class using (one vs one multi-class) linear svm ?

Resources