Part of the course Trading With Machine Learning : Classification and SVM
[ Ссылка ]
**START FOR FREE**
In this video lecture, you will learn about different mathematical functions used for building a binary classifier.
Let us start by looking at a linear equation for performing the classification. Think of training examples as points in a n-dimensional space, where each dimension represents a feature. A linear binary classifier defines a plane in the space which separates the positive outcomes from the negative ones.
For simplicity, consider this two dimensional space, where x and y axis correspond to features used to develop the classifier. The training dataset is represented by red and green dots, the aim of the linear classifier is to arrive at a straight line separating the space into two halves, such that the positive and negative outcomes lie on either side of the line.
The straight line dividing the space will have the following equation, w1x plus w2y plus w0 equal to 0. Each coefficient, wi, can be thought of as a weight corresponding to the feature. The Linear Classifier will predict an outcome based on the sign of this function,
the prediction would be positive if g(x) is greater than or equal to 0, else the prediction would be negative. The aim of the learning process is to construct a good weight vector, i.e. the vector containing the weights of the equation:
w = (w0, w1, w2).
A good weight vector is one which maximizes the probability of making correct predictions. This is done by minimizing the cost function using gradient descent, these concepts will be covered in the reading material
in the next unit.
Another mathematical function that is widely used in constructing a binary classifier is the Sigmoid function. The Sigmoid function is an S-shaped and bounded function as shown in the graph.
The sigmoid function plots the entire real axis into a bounded space, i.e. between 0 and 1. This is very useful in a binary classification problem, as we are interested in the probability of an outcome being true.
Hence, a 0 to 1 boundary on the output of the sigmoid function serves this purpose well. When the sigmoid function results in a value greater than 0.5 we predict a positive outcome, conversely when the sigmoid function returns a value less than 0.5, the outcome is predicted to be negative.
The sigmoid function is a special case of logistic function and is given by the formula:
one divided by one plus e raised to the power of minus x.
The number that S of x generates as an output is treated as the estimated probability that y is equal to 1 on an input x.
Consider the example of predicting the market movement for the next day. Assume the vector x to contain different features which are being considered while making a decision.
The y equal to 1 line represents that market should move upwards, conversely y equal to 0 represents the market is expected to move downwards.
Say for a particular input feature vector x, the sigmoid function returns a value of 0.7. It can be seen that the point where the sigmoid function would return a value of 0.7 is closer to the y equal to 1 line and hence there is a higher probability of the market moving upwards. In fact, the value 0.7 can be considered to be the estimated probability of the market moving in the upward direction.
The next mathematical function used in classification is the hyperbolic tangent function, or tanh. It is another mathematical function that is used to construct a binary classifier.
It is similar to the sigmoid function, it is an S-shaped and bounded function. Tanh plots the entire real axis into a bounded space between -1 and 1. The tanh and sigmoid functions are related by the following equation:
tanh of x is equal to 2 times sigmoid of 2x minus 1.
Tanh is used in cases when we are interested in predicting -1 or 1 rather than 0 or 1 which is done using the sigmoid function.
Quantra is an online education portal that specializes in Algorithmic and Quantitative trading. Quantra offers various bite-sized, self-paced and interactive courses that are perfect for busy professionals, seeking implementable knowledge in this domain.
Find more info on - [ Ссылка ]
Like us on Facebook: [ Ссылка ]
Follow us on Twitter: [ Ссылка ]
Ещё видео!