Alan-D-Chen / KNN_ML

Demo for KNN(K-Nearest Neighbor) & Iris module(a classical test) in data analysis in Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KNN_ML

========================================================
Demo for KNN(K-Nearest Neighbor) & Iris module(a classical test) in data analysis in Python

This is a simple demo for KNN(K-Nearest Neighbor)


>>Python3 Pycharm

02.KNN(K-Nearest Neighbor)


If you get that :
'AttributeError: 'dict' object has no attribute 'iteritems'

you will find some help from here:
*help1


If you get that :
IndexError: list index out of range

def getAccuracy(testSet, predictions):
    correct = 0
    for x in range(len(testSet)-1):
        if testSet[x][-1] == predictions[x]:
            correct += 1
    return (correct/float(len(testSet)))*100.0

you will find some help from here:
**help2

best wish for you.

About

Demo for KNN(K-Nearest Neighbor) & Iris module(a classical test) in data analysis in Python


Languages

Language:Python 100.0%