Machine Learning: Difference between revisions
No edit summary |
|||
| Line 8: | Line 8: | ||
=== Multivariate Linear Regression === | === Multivariate Linear Regression === | ||
Multivariate linear regression is a 3 step algorithm that | Multivariate linear regression is a 3 step algorithm that converts a training data set into a set of weights that most closely reproduces the answer in the training data set. | ||
The 3 steps are: | The 3 steps are: | ||
# For each parameter, set its weight to 1.0 | # For each parameter, set its weight to an arbitrary value, say 1.0 | ||
# For every piece of data, see how far off the function using the given weights are off by. The average error amount is the cost of the function. | # For every piece of data, see how far off the function using the given weights are off by. The average error amount is the cost of the function. | ||
# Repeat step 2 with different weights to minimize the cost (ie. the error) | # Repeat step 2 with different weights to minimize the cost (ie. the error) | ||
Step | Step 2 requires determining how 'wrong' the prediction is from the answer. This typically is done by: | ||
Cost = (ans1 - pred1)^2 + (ans2 - pred2)^2 + ... + (ansn - predn)^2 / n | |||
By squaring each difference, we penalize larger errors more. | |||
Step 3 requires picking new weights that reduces the cost. This can be done by something called a batch gradient descent. A gradient descent is an iterative optimization algorithm that can be used to minimize the cost function and to find the best weights. However, the data that can be handled with this approach has to be linear. | |||
== Other Topics == | == Other Topics == | ||
Revision as of 23:56, 2 September 2017
Introduction
Machine learning algorithms is an umbrella term that covers a range of generic algorithms. There are other branches of machine learning such as supervised learning, unsupervised learning, and reinforcement learning. Supervised learning is the most commonly used.
Supervised learning requires training a model with labeled training data (data with parameters and a solution). The supervised learning algorithm then generates a solution that is as close to the solution as possible. This solution can then be applied to any other problem of the same type.
Unsupervised learning is basically what data mining is: it attempts to look for hidden patterns in the data.
Multivariate Linear Regression
Multivariate linear regression is a 3 step algorithm that converts a training data set into a set of weights that most closely reproduces the answer in the training data set.
The 3 steps are:
- For each parameter, set its weight to an arbitrary value, say 1.0
- For every piece of data, see how far off the function using the given weights are off by. The average error amount is the cost of the function.
- Repeat step 2 with different weights to minimize the cost (ie. the error)
Step 2 requires determining how 'wrong' the prediction is from the answer. This typically is done by:
Cost = (ans1 - pred1)^2 + (ans2 - pred2)^2 + ... + (ansn - predn)^2 / n
By squaring each difference, we penalize larger errors more.
Step 3 requires picking new weights that reduces the cost. This can be done by something called a batch gradient descent. A gradient descent is an iterative optimization algorithm that can be used to minimize the cost function and to find the best weights. However, the data that can be handled with this approach has to be linear.
Other Topics