函数功能:返回数据集中特征下标为index,特征值等于value的子数据集
(self,X,y,index,value)
| 50 | |
| 51 | |
| 52 | def _splitDataSet(self,X,y,index,value): |
| 53 | """ |
| 54 | 函数功能:返回数据集中特征下标为index,特征值等于value的子数据集 |
| 55 | """ |
| 56 | ret = [] |
| 57 | featVec = X[:,index] |
| 58 | X = X[:,[i for i in range(X.shape[1]) if i!=index]] |
| 59 | for i in range(len(featVec)): |
| 60 | if featVec[i]==value: |
| 61 | ret.append(i) |
| 62 | return X[ret,:],y[ret] |
| 63 | |
| 64 | |
| 65 | def _chooseBestFeatureToSplit_ID3(self,X,y): |
no outgoing calls
no test coverage detected