Refactor tests

This commit is contained in:
2022-12-04 01:45:32 +01:00
parent 5cce895177
commit 9ce10131d6
5 changed files with 82 additions and 67 deletions

View File

@@ -69,13 +69,14 @@ for proposed in [True, False]:
X = data.data
y = data.target
print("*** Proposed: ", proposed)
test = CFImdlp(debug=False, proposed=proposed)
test = CFImdlp(debug=True, proposed=proposed)
test.fit(X[:, 0], y)
result = test.get_cut_points()
for item in result:
print(
f"Class={item['classNumber']} - ({item['start']:3d}, {item['end']:3d})"
f" -> ({item['fromValue']:3.1f}, {item['toValue']:3.1f}]"
f"Class={item['classNumber']} - ({item['start']:3d}, "
f"{item['end']:3d}) -> ({item['fromValue']:3.1f}, "
f"{item['toValue']:3.1f}]"
)
print(test.get_discretized_values())
print("+" * 40)
@@ -114,11 +115,14 @@ for proposed in [True, False]:
# # k = test.cut_points_ant(X[:, 0], y)
# # print(k)
# # test.debug_points(X[:, 0], y)
X = [5.7, 5.3, 5.2, 5.1, 5.0, 5.6, 5.1, 6.0, 5.1, 5.9]
indices = [4, 3, 6, 8, 2, 1, 5, 0, 9, 7]
# X = [5.7, 5.3, 5.2, 5.1, 5.0, 5.6, 5.1, 6.0, 5.1, 5.9]
# y = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2]
# indices = [4, 3, 6, 8, 2, 1, 5, 0, 9, 7]
# clf = CFImdlp(debug=True, proposed=False)
# clf.fit(X, y)
# print(clf.get_cut_points())
# y = [1, 1, 1, 1, 1, 2, 2, 2, 2, 2]
# # To check
# indices2 = np.argsort(X)
Xs = np.array(X)[indices2]
ys = np.array(y)[indices2]
# Xs = np.array(X)[indices2]
# ys = np.array(y)[indices2]