Machine Learning, After training, how exactly does it get a prediction? opencv

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 in the guide 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!

The documentation where this is found is here: reference to the tanh is under function descriptions predict. reference to activation function is by the S looking graph in the top part of the page.

Since this is a general question, and not code specific, I did not post any code with it.

-------------Problems Reply------------

I would suggest that you read about appropriate algorithm that your are using or plan to use. To be honest there is no one definite algorithm to solve a problem but you can explore what features you got and what you need.

Regarding how an algorithm performs prediction is totally depended on the choice of algorithm. Support Vector Machine (SVM) performs prediction by fitting hyperplanes on the feature space and using some metric such as distance for learning and than the learnt model is used for prediction. KNN on the other than uses simple nearest neighbor measurement for prediction.

Please do more work on what exactly you need and read through the research papers to get proper understanding. There is not magic involved in prediction but rather mathematical formulations.

Category:opencv Views:3 Time:2015-08-17

Related post

  • General Machine Learning Algorithm, Training Set -> "Predictor" 2012-03-10

    Consider the following code: struct TrainingExample { array<double, N> input; array<double, M> output; }; struct Predictor { Predictor(const vector<TrainingExample>& trainingSet); array<double, M> predict(const array<do

  • Machine learning to understand website structure in Python 2011-10-22

    I have been working on crawling webpages and extracting the elements of the website. Ex: Given a website - The crawler should return the following sections: Header, Menu, Footer, content etc. I was thinking that it would be great if I could use machi

  • Parallelising Cholesky decomposition for use in training a machine learning algorithm 2010-07-01

    I am trying to work out if I can parallelise the training aspect of a machine learning algorithm. The computationally expensive part of the training involves Cholesky decomposing a positive-definite matrix (covariance matrix). I'll try and frame the

  • In machine learning, what are things you can do to limit the number of required training samples? 2011-08-10

    In many applications, creating a large training dataset can be very costly, if not outright impossible. So what steps can one take to limit the size that is needed for good accuracy? --------------Solutions------------- Well, there is a branch of mac

  • Best approach to what I think is a machine learning problem 2009-02-07

    I am wanting some expert guidance here on what the best approach is for me to solve a problem. I have investigated some machine learning, neural networks, and stuff like that. I've investigated weka, some sort of baesian solution.. R.. several differ

  • Machine learning challenge: learn english pronunciation 2009-03-23

    Say you want to take CMU's phonetic data set input that looks like this: ABERRATION AE2 B ER0 EY1 SH AH0 N ABERRATIONAL AE2 B ER0 EY1 SH AH0 N AH0 L ABERRATIONS AE2 B ER0 EY1 SH AH0 N Z ABERT AE1 B ER0 T ABET AH0 B EH1 T ABETTED AH0 B EH1 T IH0 D ABE

  • Machine Learning in Game AI 2009-06-09

    In the old days of gaming, I'm sure simple switch/case statements (in a sense) would have done just fine for most of the game "AI." However, as games have become increasing complex, especially at the 3d leap, more complex algorithms are needed. My qu

  • Is there a recommended package for machine learning in Python? 2009-08-17

    Is there a recommended package for machine learning in Python? I have previous experience in implementing a variety of machine learning and statistical algorithms in C++ and MATLAB, but having done some work in Python I'm curious about the available

  • Machine learning challenge: diagnosing program in java/groovy (datamining, machine learning) 2009-12-03

    I'm planning to develop program in Java which will provide diagnosis. The data set is divided into two parts one for training and the other for testing. My program should learn to classify from the training data (BTW which contain answer for 30 quest

  • High volume SVM (machine learning) system 2010-03-05

    I working on a possible machine learning project that would be expected to do high speed computations for machine learning using SVM (support vector machines) and possibly some ANN. I'm resonably comfortable working on matlab with these, but primarly

  • A good machine learning technique to weed out good URLs from bad 2010-03-11

    I have an application that needs to discriminate between good HTTP GET requests and bad. For example: # BAD # GOOD My system can make a binary decision about wh

  • Adapting Machine Learning Algorithms to my Problem 2010-03-22

    i'm working on a project and need your ideas, advices. First of all, let me tell my problem. There is power button and some other keys of a machine and there is only one user has authentication to use this machine.There are no other authentication me

  • Machine Learning Algorithm for Predicting Order of Events? 2010-03-26

    Simple machine learning question. Probably numerous ways to solve this: There is an infinite stream of 4 possible events: 'event_1', 'event_2', 'event_4', 'event_4' The events do not come in in completely random order. We will assume that there are s

  • When to choose which machine learning classifier? 2010-04-07

    Suppose I'm working on some classification problem. (Fraud detection and comment spam are two problems I'm working on right now, but I'm curious about any classification task in general.) How do I know which classifier I should use? (Decision tree, S

  • What is machine learning? 2010-04-12

    What is machine learning ? What does machine learning code do ? When we say that the machine learns, does it modify the code of itself or it modifies history (database) which will contain the experience of code for given set of inputs? --------------

  • How to engineer features for machine learning 2010-04-20

    Do you have some advices or reading how to engineer features for a machine learning task? Good input features are important even for a neural network. The chosen features will affect the needed number of hidden neurons and the needed number of traini

  • Machine Learning Algorithm for Peer-to-Peer Nodes 2010-05-30

    I want to apply machine learning to a classification problem in a parallel environment. Several independent nodes, each with multiple on/off sensors, can communicate their sensor data with the goal of classifying an event as defined by a heuristic, t

  • Fastest general machine learning library? 2010-07-02

    Weka is probably the most popular general purpose machine learning library. But it can be quite slow in my experience. I have been looking at Shark, Waffles, dlib, Plearn, and MLC++ as alternatives. Of these, Shark and dlib look the most promising. D

  • What subjects, topics does a computer science graduate need to learn to apply available machine learning frameworks, esp. SVMs 2010-09-21

    I want to teach myself enough machine learning so that I can, to begin with, understand enough to put to use available open source ML frameworks that will allow me to do things like: Go through the HTML source of pages from a certain site and "unders

Copyright (C), All Rights Reserved.

processed in 0.084 (s). 11 q(s)