MCPcopy Index your code
hub / github.com/wepe/MachineLearning / fit

Method fit

DecisionTree/id3_c45.py:179–192  ·  view source on GitHub ↗
(self,X,y)

Source from the content-addressed store, hash-verified

177 return myTree
178
179 def fit(self,X,y):
180 #类型检查
181 if isinstance(X,np.ndarray) and isinstance(y,np.ndarray):
182 pass
183 else:
184 try:
185 X = np.array(X)
186 y = np.array(y)
187 except:
188 raise TypeError("numpy.ndarray required for X,y")
189
190 featureIndex = tuple(['x'+str(i) for i in range(X.shape[1])])
191 self._tree = self._createTree(X,y,featureIndex)
192 return self #allow chaining: clf.fit().predict()
193
194
195

Callers 4

cnn.pyFile · 0.45
cnn.pyFile · 0.45
svcFunction · 0.45
rfFunction · 0.45

Calls 1

_createTreeMethod · 0.95

Tested by

no test coverage detected