October 2017
Beginner to intermediate
270 pages
7h
English
For this simple implementation of the K-NN method, we will use the NumPy and Matplotlib libraries. Also, as we will be generating a synthetic dataset for better comprehension, we will use the make_blobs method from scikit-learn, which will generate well-defined and separated groups of information so we have a sure reference for our implementation.
Importing the required libraries:
import numpy as np import matplotlib import matplotlib.pyplot as plt from sklearn.datasets.samples_generator import make_blobs %matplotlib inlineSo, it's time to generate the data samples for this example. The parameters of make_blobs are the number of samples, the number of features or dimensions, the quantity of centers ...
Read now
Unlock full access