This commit is contained in:
geekidentity
2017-03-09 23:40:35 +08:00
parent cee4fcaf3c
commit 80d13d761b
2 changed files with 19 additions and 1 deletions

18
src/python/02.kNN/kNN.py Normal file
View File

@@ -0,0 +1,18 @@
'''
导入科学计算包numpy和运算符模块operator
@author: geekidentity
'''
from numpy import *
import operator
'''
创建数据集和标签
调用方式
import kNN
group, labels = createDateSet()11
'''
def createDataSet():
group = array([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1]])
labels = ['A','A','B','B']
return group, labels