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

Function loadDataSet

Regression Trees/regTrees.py:5–23  ·  view source on GitHub ↗

函数说明:加载数据 Parameters: fileName - 文件名 Returns: dataMat - 数据矩阵 Website: http://www.cuijiahua.com/ Modify: 2017-12-09

(fileName)

Source from the content-addressed store, hash-verified

3import numpy as np
4
5def loadDataSet(fileName):
6 """
7 函数说明:加载数据
8 Parameters:
9 fileName - 文件名
10 Returns:
11 dataMat - 数据矩阵
12 Website:
13 http://www.cuijiahua.com/
14 Modify:
15 2017-12-09
16 """
17 dataMat = []
18 fr = open(fileName)
19 for line in fr.readlines():
20 curLine = line.strip().split('\t')
21 fltLine = list(map(float, curLine)) #转化为float类型
22 dataMat.append(fltLine)
23 return dataMat
24
25def plotDataSet(filename):
26 """

Callers 2

plotDataSetFunction · 0.70
regTrees.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected