In terms of machine learning, a lazy model is a model that is not saved as a trained model. It actually trained itself as we predict because it will again go through all the training datasets in order to predict or classify the input dataset. A simple example of a lazy model in Machine learning is the KNN model. A KNN model finds the distance of the input data with all the training data points before classifying it.

Let us dive into depth to understand what is a lazy model and why KNN is known as a lazy model.

## What is a Lazy Model?

A Lazy model in machine learning is a model that is not trained on a specific formula and saved. Actually, it again goes through the training dataset as you predict for the input dataset. While other models use a specific formula or generalization for making predictions and use this generalization in the future as well. On the other hand, a lazy learner model will again go through the dataset in order to predict the future as well.

Here are some of the common features of a lazy model.

- Memory based model
- Instance similarity
- Non-parametric
- Searching and comparing
- Flexible decision boundaries
- Train again and again
- No generalizations

### Why KNN is a Lazy Learner?

One of the examples of a lazy learner or lazy algorithm is the KNN algorithm. A KNN algorithm is a supervised (also unsupervised in some cases) algorithm that is mostly used for classification purposes. The KNN model uses various distance formulae to calculate the distance from the input values to the dataset and uses these distance formulae to make predictions.

One of the most important parameters of the KNN model is the value of K. This value defines the total number of data points with whom the model needs to compare the incoming point to predict or classify.

Here are some of the common features of a KNN model.

- Lazy learner
- Uses distance formula
- Uses nearest neighbors to classify
- Classify based on majority voting
- Best for a small dataset
- Training takes less time on a small dataset
- Give good results for binary classification

## Summary

A lazy model also known as a lazy learner or lazy algorithm is actually a machine learning model that predicts the input data based on a memory-based approach. One of the examples of the lazy model is the KNN model which uses the distance formula in order to calculate the distance from the input data to all the training data points and then based on majority voting, it classifies.

## FAQs

### Can we visualize the KNN-trained model?

You can visualize and plot the KNN model using matplotlib module in various ways.

### Give an example of the Lazy model

The KNN algorithm is the best example of a lazy model

### How lazy model is trained?

The lazy model uses the memory-based approach to memorize the dataset rather than using a generalization approach.