函数说明:绘制数据集 Parameters: filename - 文件名 Returns: 无 Website: http://www.cuijiahua.com/ Modify: 2017-11-12
(filename)
| 23 | return dataMat |
| 24 | |
| 25 | def plotDataSet(filename): |
| 26 | """ |
| 27 | 函数说明:绘制数据集 |
| 28 | Parameters: |
| 29 | filename - 文件名 |
| 30 | Returns: |
| 31 | 无 |
| 32 | Website: |
| 33 | http://www.cuijiahua.com/ |
| 34 | Modify: |
| 35 | 2017-11-12 |
| 36 | """ |
| 37 | dataMat = loadDataSet(filename) #加载数据集 |
| 38 | n = len(dataMat) #数据个数 |
| 39 | xcord = []; ycord = [] #样本点 |
| 40 | for i in range(n): |
| 41 | xcord.append(dataMat[i][0]); ycord.append(dataMat[i][1]) #样本点 |
| 42 | fig = plt.figure() |
| 43 | ax = fig.add_subplot(111) #添加subplot |
| 44 | ax.scatter(xcord, ycord, s = 20, c = 'blue',alpha = .5) #绘制样本点 |
| 45 | plt.title('DataSet') #绘制title |
| 46 | plt.xlabel('X') |
| 47 | plt.show() |
| 48 | |
| 49 | def binSplitDataSet(dataSet, feature, value): |
| 50 | """ |
nothing calls this directly
no test coverage detected