MCPcopy Create free account
hub / github.com/Jack-Cherish/Machine-Learning / plotDataSet

Function plotDataSet

Regression/regression_old.py:53–75  ·  view source on GitHub ↗

函数说明:绘制数据集 Parameters: 无 Returns: 无 Website: http://www.cuijiahua.com/ Modify: 2017-11-12

()

Source from the content-addressed store, hash-verified

51
52
53def plotDataSet():
54 """
55 函数说明:绘制数据集
56 Parameters:
57
58 Returns:
59
60 Website:
61 http://www.cuijiahua.com/
62 Modify:
63 2017-11-12
64 """
65 xArr, yArr = loadDataSet('ex0.txt') #加载数据集
66 n = len(xArr) #数据个数
67 xcord = []; ycord = [] #样本点
68 for i in range(n):
69 xcord.append(xArr[i][1]); ycord.append(yArr[i]) #样本点
70 fig = plt.figure()
71 ax = fig.add_subplot(111) #添加subplot
72 ax.scatter(xcord, ycord, s = 20, c = 'blue',alpha = .5) #绘制样本点
73 plt.title('DataSet') #绘制title
74 plt.xlabel('X')
75 plt.show()
76
77def plotRegression():
78 """

Callers

nothing calls this directly

Calls 1

loadDataSetFunction · 0.70

Tested by

no test coverage detected