Repaired prediction, changed dataset
This commit is contained in:
parent
42d09e21f8
commit
7add741845
@ -11,11 +11,10 @@ time_since_flush = [1,2,3,4,5,6,7,8,9,10]
|
||||
type_of_trash = {"bio":1, "szklo":2, "plastik":3, "papier":4, "mieszane":5}
|
||||
access_to_bin = { "no":1, "yes":2}
|
||||
distance = [1,2,3,4,5,6,7,8,9,10]
|
||||
decision = [1,2,3,4,5]
|
||||
decision = [0,1] - decyzje zostaną zmienione z tych z wagami na zero jedynkowe ze względu na pewne trudności w dalszej pracy
|
||||
'''
|
||||
decisions = ["decision"]
|
||||
attributes = ["season", "enough_space_in_trashmaster", "time_since_flush", "type_of_trash", "access_to_bin", "distance",
|
||||
"decision"]
|
||||
attributes = ["season", "enough_space_in_trashmaster", "time_since_flush", "type_of_trash", "access_to_bin", "distance"]
|
||||
|
||||
|
||||
# return tree made from attributes
|
||||
@ -60,6 +59,10 @@ def tree_to_png(decision_tree):
|
||||
def tree_to_structure(decision_tree):
|
||||
joblib.dump(decision_tree, './decision_tree/tree_model')
|
||||
|
||||
|
||||
def tree_from_structure(file):
|
||||
return joblib.load(file)
|
||||
|
||||
#drzewo = tree()
|
||||
#tree_as_txt(drzewo)
|
||||
#tree_to_png(drzewo)
|
||||
|
@ -2,30 +2,30 @@ season,enough_space_in_trashmaster,time_since_flush,type_of_trash,access_to_bin,
|
||||
2,2,1,1,2,10,1
|
||||
2,2,2,2,2,8,1
|
||||
2,2,3,3,2,6,1
|
||||
2,2,4,4,2,4,2
|
||||
2,2,5,5,2,2,3
|
||||
2,2,6,1,2,1,5
|
||||
2,2,7,2,2,3,4
|
||||
2,2,8,3,2,5,4
|
||||
2,2,9,4,2,7,3
|
||||
2,2,10,5,2,9,5
|
||||
2,2,1,1,2,2,1
|
||||
2,2,4,4,2,4,0
|
||||
2,2,5,5,2,2,0
|
||||
2,2,6,1,2,1,1
|
||||
2,2,7,2,2,3,1
|
||||
2,2,8,3,2,5,0
|
||||
2,2,9,4,2,7,0
|
||||
2,2,10,5,2,9,1
|
||||
2,2,1,1,2,2,0
|
||||
2,2,2,2,2,1,1
|
||||
2,2,3,3,2,3,2
|
||||
2,2,4,4,2,4,2
|
||||
2,2,5,5,2,5,3
|
||||
2,2,6,1,2,6,3
|
||||
2,2,7,2,2,7,2
|
||||
2,2,8,3,2,8,2
|
||||
2,2,9,4,2,9,4
|
||||
2,2,10,5,2,10,4
|
||||
2,2,3,3,2,3,0
|
||||
2,2,4,4,2,4,1
|
||||
2,2,5,5,2,5,0
|
||||
2,2,6,1,2,6,1
|
||||
2,2,7,2,2,7,0
|
||||
2,2,8,3,2,8,1
|
||||
2,2,9,4,2,9,0
|
||||
2,2,10,5,2,10,1
|
||||
2,2,1,1,2,7,1
|
||||
2,2,2,2,2,6,2
|
||||
2,2,3,3,2,5,3
|
||||
2,2,2,2,2,6,0
|
||||
2,2,3,3,2,5,1
|
||||
2,2,4,4,1,4,0
|
||||
2,2,5,5,1,3,0
|
||||
2,2,6,1,1,2,0
|
||||
2,2,7,2,1,1,0
|
||||
2,2,7,2,1,1,1
|
||||
2,2,8,3,1,9,0
|
||||
2,2,9,4,1,8,0
|
||||
2,2,10,5,1,7,0
|
||||
@ -51,24 +51,24 @@ season,enough_space_in_trashmaster,time_since_flush,type_of_trash,access_to_bin,
|
||||
2,1,10,5,2,9,0
|
||||
3,2,1,1,2,2,1
|
||||
3,2,2,2,2,1,1
|
||||
3,2,3,3,2,4,2
|
||||
3,2,4,4,2,3,3
|
||||
3,2,5,5,2,6,4
|
||||
3,2,6,1,2,5,4
|
||||
3,2,7,2,2,8,3
|
||||
3,2,8,3,2,7,3
|
||||
3,2,9,4,2,9,4
|
||||
3,2,10,5,2,10,5
|
||||
3,2,3,3,2,4,1
|
||||
3,2,4,4,2,3,0
|
||||
3,2,5,5,2,6,1
|
||||
3,2,6,1,2,5,1
|
||||
3,2,7,2,2,8,0
|
||||
3,2,8,3,2,7,1
|
||||
3,2,9,4,2,9,1
|
||||
3,2,10,5,2,10,0
|
||||
3,2,1,1,2,7,1
|
||||
3,2,2,2,2,6,1
|
||||
3,2,3,3,2,4,3
|
||||
3,2,4,4,2,1,3
|
||||
3,2,5,5,2,2,4
|
||||
3,2,6,1,2,3,4
|
||||
3,2,7,2,2,9,3
|
||||
3,2,8,3,2,8,3
|
||||
3,2,9,4,2,5,5
|
||||
3,2,10,5,2,4,5
|
||||
3,2,3,3,2,4,1
|
||||
3,2,4,4,2,1,0
|
||||
3,2,5,5,2,2,1
|
||||
3,2,6,1,2,3,1
|
||||
3,2,7,2,2,9,0
|
||||
3,2,8,3,2,8,0
|
||||
3,2,9,4,2,5,1
|
||||
3,2,10,5,2,4,0
|
||||
3,2,1,1,2,1,1
|
||||
3,2,2,2,1,7,0
|
||||
3,2,3,3,1,9,0
|
||||
@ -99,3 +99,103 @@ season,enough_space_in_trashmaster,time_since_flush,type_of_trash,access_to_bin,
|
||||
3,1,8,3,2,9,0
|
||||
3,1,9,4,2,9,0
|
||||
3,1,10,5,2,1,0
|
||||
4,2,1,1,2,9,1
|
||||
4,2,2,2,2,7,1
|
||||
4,2,3,3,2,5,1
|
||||
4,2,4,4,2,3,1
|
||||
4,2,5,5,2,1,1
|
||||
4,2,6,1,2,2,1
|
||||
4,2,7,2,2,2,1
|
||||
4,2,8,3,2,4,1
|
||||
4,2,9,4,2,6,1
|
||||
4,2,10,5,2,8,1
|
||||
4,2,1,1,2,1,1
|
||||
4,2,2,2,2,3,1
|
||||
4,2,3,3,2,5,1
|
||||
4,2,4,4,2,6,1
|
||||
4,2,5,5,2,4,1
|
||||
4,2,6,1,2,5,1
|
||||
4,2,7,2,2,6,1
|
||||
4,2,8,3,2,7,1
|
||||
4,2,9,4,2,8,1
|
||||
4,2,10,5,2,10,1
|
||||
4,2,1,1,2,6,1
|
||||
4,2,7,2,2,3,1
|
||||
4,2,8,3,2,5,1
|
||||
4,2,9,4,2,7,1
|
||||
4,2,10,5,2,9,1
|
||||
4,2,1,1,2,2,1
|
||||
4,2,7,2,1,1,0
|
||||
4,2,8,3,1,9,0
|
||||
4,2,9,4,1,8,0
|
||||
4,2,10,5,1,7,0
|
||||
4,2,1,1,1,3,0
|
||||
4,2,2,2,1,2,0
|
||||
4,2,3,3,1,1,0
|
||||
4,2,4,4,1,4,0
|
||||
4,2,5,5,1,5,0
|
||||
4,2,6,1,1,6,0
|
||||
4,2,7,2,1,10,0
|
||||
4,2,8,3,1,9,0
|
||||
4,2,9,4,1,8,0
|
||||
4,2,10,5,1,7,0
|
||||
4,2,1,1,1,2,0
|
||||
4,2,2,2,1,4,0
|
||||
4,2,3,3,1,6,0
|
||||
4,2,4,4,1,8,0
|
||||
4,2,5,5,2,10,1
|
||||
4,2,6,1,2,1,1
|
||||
4,1,2,2,2,5,1
|
||||
4,1,3,3,2,4,1
|
||||
4,1,4,4,1,3,0
|
||||
4,1,5,5,1,2,0
|
||||
4,1,6,1,1,1,0
|
||||
1,2,2,2,2,1,1
|
||||
1,2,3,3,2,4,1
|
||||
1,2,4,4,2,3,1
|
||||
1,2,5,5,2,6,1
|
||||
1,2,6,1,2,5,1
|
||||
1,2,7,2,2,8,1
|
||||
1,2,8,3,2,7,1
|
||||
1,2,9,4,2,9,1
|
||||
1,2,10,5,2,10,1
|
||||
1,2,1,1,2,7,1
|
||||
1,2,2,2,2,6,1
|
||||
1,2,3,3,2,4,0
|
||||
1,2,4,4,2,1,1
|
||||
1,2,5,5,2,2,1
|
||||
1,2,6,1,2,3,1
|
||||
1,2,7,2,2,9,1
|
||||
1,2,8,3,2,8,0
|
||||
1,2,9,4,2,5,1
|
||||
1,2,10,5,2,4,1
|
||||
1,2,1,1,2,1,1
|
||||
1,2,2,2,1,7,0
|
||||
1,2,3,3,1,9,0
|
||||
1,2,4,4,1,10,0
|
||||
1,2,5,5,1,3,0
|
||||
1,2,6,1,1,2,0
|
||||
1,2,7,2,1,5,0
|
||||
1,2,8,3,1,6,0
|
||||
1,2,9,4,1,8,0
|
||||
1,2,10,5,1,3,0
|
||||
1,2,1,1,1,1,0
|
||||
1,2,2,2,1,2,0
|
||||
1,2,3,3,1,6,0
|
||||
1,2,4,4,1,9,0
|
||||
1,2,5,5,1,7,0
|
||||
1,2,6,1,1,4,0
|
||||
1,2,7,2,1,3,0
|
||||
1,2,8,3,1,5,0
|
||||
1,2,9,4,1,10,0
|
||||
1,2,10,5,1,8,0
|
||||
1,2,1,1,2,2,1
|
||||
1,1,2,2,2,4,0
|
||||
1,1,3,3,2,6,0
|
||||
1,1,4,4,2,7,0
|
||||
1,1,5,5,2,1,0
|
||||
1,1,6,1,2,9,0
|
||||
1,1,7,2,2,3,0
|
||||
1,1,8,3,2,9,0
|
||||
1,1,9,4,2,9,0
|
||||
1,1,10,5,2,1,0
|
||||
|
|
@ -1,16 +1,94 @@
|
||||
|--- feature_6 <= 0.50
|
||||
| |--- class: 0
|
||||
|--- feature_6 > 0.50
|
||||
| |--- feature_6 <= 1.50
|
||||
| | |--- class: 1
|
||||
| |--- feature_6 > 1.50
|
||||
| | |--- feature_6 <= 3.50
|
||||
| | | |--- feature_6 <= 2.50
|
||||
| | | | |--- class: 2
|
||||
| | | |--- feature_6 > 2.50
|
||||
| | | | |--- class: 3
|
||||
| | |--- feature_6 > 3.50
|
||||
| | | |--- feature_6 <= 4.50
|
||||
| | | | |--- class: 4
|
||||
| | | |--- feature_6 > 4.50
|
||||
| | | | |--- class: 5
|
||||
|--- feature_4 <= 1.50
|
||||
| |--- feature_5 <= 1.50
|
||||
| | |--- feature_2 <= 6.50
|
||||
| | | |--- class: 0
|
||||
| | |--- feature_2 > 6.50
|
||||
| | | |--- feature_0 <= 3.00
|
||||
| | | | |--- class: 1
|
||||
| | | |--- feature_0 > 3.00
|
||||
| | | | |--- class: 0
|
||||
| |--- feature_5 > 1.50
|
||||
| | |--- class: 0
|
||||
|--- feature_4 > 1.50
|
||||
| |--- feature_1 <= 1.50
|
||||
| | |--- feature_0 <= 3.50
|
||||
| | | |--- class: 0
|
||||
| | |--- feature_0 > 3.50
|
||||
| | | |--- class: 1
|
||||
| |--- feature_1 > 1.50
|
||||
| | |--- feature_0 <= 3.50
|
||||
| | | |--- feature_0 <= 1.50
|
||||
| | | | |--- feature_3 <= 2.50
|
||||
| | | | | |--- class: 1
|
||||
| | | | |--- feature_3 > 2.50
|
||||
| | | | | |--- feature_3 <= 3.50
|
||||
| | | | | | |--- feature_5 <= 7.50
|
||||
| | | | | | | |--- feature_2 <= 5.50
|
||||
| | | | | | | | |--- class: 0
|
||||
| | | | | | | |--- feature_2 > 5.50
|
||||
| | | | | | | | |--- class: 1
|
||||
| | | | | | |--- feature_5 > 7.50
|
||||
| | | | | | | |--- class: 0
|
||||
| | | | | |--- feature_3 > 3.50
|
||||
| | | | | | |--- class: 1
|
||||
| | | |--- feature_0 > 1.50
|
||||
| | | | |--- feature_3 <= 1.50
|
||||
| | | | | |--- feature_5 <= 2.50
|
||||
| | | | | | |--- feature_5 <= 1.50
|
||||
| | | | | | | |--- class: 1
|
||||
| | | | | | |--- feature_5 > 1.50
|
||||
| | | | | | | |--- feature_0 <= 2.50
|
||||
| | | | | | | | |--- class: 0
|
||||
| | | | | | | |--- feature_0 > 2.50
|
||||
| | | | | | | | |--- class: 1
|
||||
| | | | | |--- feature_5 > 2.50
|
||||
| | | | | | |--- class: 1
|
||||
| | | | |--- feature_3 > 1.50
|
||||
| | | | | |--- feature_2 <= 3.50
|
||||
| | | | | | |--- feature_0 <= 2.50
|
||||
| | | | | | | |--- feature_5 <= 2.00
|
||||
| | | | | | | | |--- class: 1
|
||||
| | | | | | | |--- feature_5 > 2.00
|
||||
| | | | | | | | |--- feature_5 <= 4.00
|
||||
| | | | | | | | | |--- class: 0
|
||||
| | | | | | | | |--- feature_5 > 4.00
|
||||
| | | | | | | | | |--- feature_3 <= 2.50
|
||||
| | | | | | | | | | |--- feature_5 <= 7.00
|
||||
| | | | | | | | | | | |--- class: 0
|
||||
| | | | | | | | | | |--- feature_5 > 7.00
|
||||
| | | | | | | | | | | |--- class: 1
|
||||
| | | | | | | | | |--- feature_3 > 2.50
|
||||
| | | | | | | | | | |--- class: 1
|
||||
| | | | | | |--- feature_0 > 2.50
|
||||
| | | | | | | |--- class: 1
|
||||
| | | | | |--- feature_2 > 3.50
|
||||
| | | | | | |--- feature_5 <= 1.50
|
||||
| | | | | | | |--- class: 0
|
||||
| | | | | | |--- feature_5 > 1.50
|
||||
| | | | | | | |--- feature_3 <= 2.50
|
||||
| | | | | | | | |--- feature_5 <= 5.00
|
||||
| | | | | | | | | |--- class: 1
|
||||
| | | | | | | | |--- feature_5 > 5.00
|
||||
| | | | | | | | | |--- class: 0
|
||||
| | | | | | | |--- feature_3 > 2.50
|
||||
| | | | | | | | |--- feature_5 <= 5.50
|
||||
| | | | | | | | | |--- feature_0 <= 2.50
|
||||
| | | | | | | | | | |--- feature_2 <= 4.50
|
||||
| | | | | | | | | | | |--- class: 0
|
||||
| | | | | | | | | | |--- feature_2 > 4.50
|
||||
| | | | | | | | | | | |--- class: 0
|
||||
| | | | | | | | | |--- feature_0 > 2.50
|
||||
| | | | | | | | | | |--- feature_2 <= 4.50
|
||||
| | | | | | | | | | | |--- class: 0
|
||||
| | | | | | | | | | |--- feature_2 > 4.50
|
||||
| | | | | | | | | | | |--- truncated branch of depth 2
|
||||
| | | | | | | | |--- feature_5 > 5.50
|
||||
| | | | | | | | | |--- feature_5 <= 6.50
|
||||
| | | | | | | | | | |--- class: 1
|
||||
| | | | | | | | | |--- feature_5 > 6.50
|
||||
| | | | | | | | | | |--- feature_2 <= 8.50
|
||||
| | | | | | | | | | | |--- truncated branch of depth 3
|
||||
| | | | | | | | | | |--- feature_2 > 8.50
|
||||
| | | | | | | | | | | |--- truncated branch of depth 4
|
||||
| | |--- feature_0 > 3.50
|
||||
| | | |--- class: 1
|
||||
|
Binary file not shown.
4
main.py
4
main.py
@ -20,6 +20,10 @@ def printTree():
|
||||
decisionTree.tree_as_txt(tree)
|
||||
decisionTree.tree_to_png(tree)
|
||||
decisionTree.tree_to_structure(tree)
|
||||
drzewo = decisionTree.tree_from_structure('./decision_tree/tree_model')
|
||||
print("Dla losowych danych predykcja czy wziąć kosz to: ")
|
||||
dec = decisionTree.decision(drzewo, 4, 2, 7, 4, 2, 3)
|
||||
print(dec)
|
||||
|
||||
|
||||
class Game():
|
||||
|
Loading…
Reference in New Issue
Block a user