Machine Learning K Nearest Neighbour Part 2

preview_player
Показать описание
This video will explain - naive implementation of K nearest neighbor classifier in python with random test data set.
Рекомендации по теме
Комментарии
Автор

your videos are just awesome i searched many ML tutorials on Internet and I found yours to be one of the best!!

ekaanshkhosla
Автор

Thanks for the video. You should edit out the part regarding the bracket error.

MrBigmit
Автор

One doubt why you are using df.ix instead can we use df.iloc to access each element from data frame

santoshkumar-jcje
Автор

Thank you sir for this informative series of videos. I am not able to run this programe in python 3.6. Matplotlib is giving error. Please help.

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

data = np.array([[-1, -1, 'C1'], [-2, -1, 'C1'], [-3, -2, 'C1'], [1, 1, 'C2'], [2, 1, 'C2'], [3, 2, 'C2']])
query=[-2.5, -1.5]

df=pd.DataFrame(data)
df.columns =['x', 'y', 'Cat']
df

for i in range(6):
if(df.ix[i]['Cat'] == 'C1'):
plt.scatter(df.iloc[i]['x'], df.iloc[i]['y'], s=150, c='r') #error line
#working linke below
#print(df.iloc[i]['x'], df.iloc[i]['y'])
else:
plt.scatter(df.iloc[i]['x'], df.iloc[i]['y'], s=150, c='b')
#working line below
#print(df.iloc[i]['x'], df.iloc[i]['y'])

nitinvij