mirror of
https://github.com/apachecn/ailearning.git
synced 2026-05-09 07:31:53 +08:00
18 lines
347 B
Python
18 lines
347 B
Python
'''
|
|
导入科学计算包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 |