Adding examples and attributes
This commit is contained in:
parent
0099d64e54
commit
9715493351
16
main.py
16
main.py
@ -8,6 +8,22 @@ import blocks
|
|||||||
from pygame.locals import *
|
from pygame.locals import *
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
examples = [
|
||||||
|
['piasek', 'sucha', 'jalowa', 'żółty'],
|
||||||
|
['czarnoziem', 'wilgotna', 'bogata', 'brazowa'],
|
||||||
|
['rzedzina', 'wilgotna', 'bogata', 'zielona'],
|
||||||
|
['gleby murszowe', 'wilgotna', 'bogata', 'szara'],
|
||||||
|
['pustynne gleby', 'sucha', 'jalowa', 'pomarańczowa'],
|
||||||
|
['torfowiska', 'sucha', 'jalowa', 'czerwona']
|
||||||
|
]
|
||||||
|
|
||||||
|
attributes = ['typ_gleby', 'wilgotność', 'zawartość_składników', 'kolor']
|
||||||
|
|
||||||
|
# Tworzenie obiektu TreeLearn i nauka drzewa decyzyjnego
|
||||||
|
tree_learner = TreeLearn()
|
||||||
|
default_class = 'nieznane'
|
||||||
|
|
||||||
|
tree_learner.train(examples, attributes, default_class)
|
||||||
|
|
||||||
class TreeLearn:
|
class TreeLearn:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user