OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Wed, 01 Apr 2015 14:55:39 -0500Machine Learning, After training, how exactly does it get a prediction?http://answers.opencv.org/question/58956/machine-learning-after-training-how-exactly-does-it-get-a-prediction/ So after you have a machine learning algorithm trained, with your layers, nodes, and weights, how exactly does it go about getting a prediction for an input vector? I am using MultiLayer Perceptron (neural networks).
From what I currently understand, you start with your input vector to be predicted. Then you send it to your hidden layer(s) where it adds your bias term to each data point, then adds the sum of the product of each data point and the weight for each node (found in training), then runs that through the same activation function used in training. Repeat for each hidden layer, then does the same for your output layer. Then each node in the output layer is your prediction(s). Is this correct?
I got confused when using opencv to do this, because it says when you use the function predict:
"If you are using the default cvANN_MLP::SIGMOID_SYM activation function with the default parameter values fparam1=0 and fparam2=0 then the function used is y = 1.7159*tanh(2/3 * x), so the output will range from [-1.7159, 1.7159], instead of [0,1]."
However, when training it is also stated in the documentation that SIGMOID_SYM uses the activation function: " f(x)= beta*(1-e^{-alpha x})/(1+e^{-alpha x} ) " Where alpha and beta are user defined variables.
So, I'm not quite sure what this means. Where does the tanh function come into play? Can anyone clear this up please? Thanks for the time!
Since this is a general question, and not code specific, I did not post any code with it.tjohnsenWed, 01 Apr 2015 14:55:39 -0500http://answers.opencv.org/question/58956/Training SVM with sigmoid kernel in opencv2.4.9http://answers.opencv.org/question/51771/training-svm-with-sigmoid-kernel-in-opencv249/Hi all,
I have to make an activity classification based on simple features I extract from images.
I am using support vector machines from the opencv machine learning library for this.
So far I'm getting very decent results with RBF and Polynomial kernels, but the accuracy and precision for the sigmoid kernel don't seem to get higher than 0.12 .
In literature I found that the sigmoid kernel is only a pd (positive definite) kernel when *gamma >0* && *coef0*<0, however, i can't try this because opencv requires all kernel parameters to be positive. I have checked the source for the SVM diagonally, but all i can see is this function where both gamma and coef0 get inverted.
calc_non_rbf_base( vcount, var_count, vecs, another, results,
-2*params.gamma, -2*params.coef0 );
Has anyone ever had succes with the sigmoid kernel in opencv ?
JorsWed, 03 Dec 2014 15:27:17 -0600http://answers.opencv.org/question/51771/