Learning Vector Quantization ( or LVQ ) is a type of Artificial Neural Network which also inspired by biological models of neural systems. It is based on prototype supervised learning classification algorithm and trained its network through a competitive learning algorithm similar to Self Organizing Map. It can also deal with the multiclass classification problem. LVQ has two layers, one is the Input layer and the other one is the Output layer. The architecture of the Learning Vector Quantization with the number of classes in an input data and n number of input features for any sample is given below:
How Learning Vector Quantization works?
Let say an input data of size ( m, n ) where m is number of training example and n is the number of features in each example and a label vector of size ( m, 1 ). First, it initializes the weights of size ( n, c ) from the first c number of training samples with different labels and should be discarded from all training samples. Here, c is the number of classes. Then iterate over the remaining input data, for each training example, it updates the winning vector ( weight vector with the shortest distance ( e.g Euclidean distance ) from training example ). Weight updation rule is given by :
wij = wij(old) - alpha(t) * (xik - wij(old))
where alpha is a learning rate at time t, j denotes the winning vector, i denotes the ith feature of training example and k denotes the kth training example from the input data. After training the LVQ network, trained weights are used for classifying new examples. A new example labeled with the class of winning vector.
Steps involved are :
- Weight initialization
- For 1 to N number of epochs
- Select a training example
- Compute the winning vector
- Update the winning vector
- Repeat steps 3, 4, 5 for all training example.
- Classify test sample
Below is the implementation.
Sample T belongs to class : 0
Trained weights : [[0.3660931, 0.38165410000000005, 1, 1], [0.33661, 0.34390000000000004, 0, 1]]
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Learning Model Building in Scikit-learn : A Python Machine Learning Library
- ML | Reinforcement Learning Algorithm : Python Implementation using Q-learning
- How to Start Learning Machine Learning?
- Difference Between Artificial Intelligence vs Machine Learning vs Deep Learning
- Difference Between Machine Learning and Deep Learning
- Decision Threshold In Machine Learning
- Creating a simple machine learning model
- seq2seq model in Machine Learning
- Best Python libraries for Machine Learning
- Deep Learning with PyTorch | An Introduction
- Q-Learning in Python
- Beginner Tips for Learning Python
- Prediction of Wine type using Deep Learning
- Avengers Endgame and Deep learning | Image Caption Generation using the Avengers EndGames Characters
- Machine Learning for Anomaly Detection
- How to approach a Machine Learning project : A step-wise guidance
- 30 minutes to machine learning
- Python | Generate test datasets for Machine learning
- Q-learning Mathematical Background
- Deep Q-Learning
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.