假设我有一个数据集:
X y
20 0
22 0
24 1
27 0
30 1
40 1
20 0
...
我试图通过最小化熵离散X成几箱。所以我做了以下内容:
clf = tree.DecisionTreeClassifier(criterion = 'entropy',max_depth = 4)
clf.fit(X.values.reshape(-1,1),y.values)
threshold = clf.tree_.threshold[clf.tree_.threshold>-2]
threshold = np.sort(threshold)
“门槛”应该给劈分,这是装箱数据的正确方法是什么?
有什么建议么?
第一,你做了什么是正确的。
有许多方法来斌您的数据: