forked from s444420/AL-2020
costam
This commit is contained in:
parent
8e18c0f39e
commit
dceb5bd8d5
@ -3,5 +3,5 @@
|
|||||||
<component name="JavaScriptSettings">
|
<component name="JavaScriptSettings">
|
||||||
<option name="languageLevel" value="ES6" />
|
<option name="languageLevel" value="ES6" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (AL-2020)" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (AL-2020)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
@ -4,7 +4,7 @@
|
|||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Python 3.8 (AL-2020)" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.7 (AL-2020)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
Binary file not shown.
Binary file not shown.
2
data.py
2
data.py
@ -40,7 +40,7 @@ learning_data = [
|
|||||||
['gold', 'rectangle', 40, 'medium', 'Twix'],
|
['gold', 'rectangle', 40, 'medium', 'Twix'],
|
||||||
['gold', 'rectangle', 50, 'medium', 'Prince-polo'],
|
['gold', 'rectangle', 50, 'medium', 'Prince-polo'],
|
||||||
['brown', 'rectangle', 55, 'medium', 'Snickers'],
|
['brown', 'rectangle', 55, 'medium', 'Snickers'],
|
||||||
['brown', 'rectangle', 45, 'medium', 'Lion'],
|
['brown', 'rectangle', 45, 'medium', 'Lion'],
|
||||||
['white', 'rectangle', 40, 'medium', 'Kinder-bueno'],
|
['white', 'rectangle', 40, 'medium', 'Kinder-bueno'],
|
||||||
['red', 'rectangle', 50, 'medium', 'Kit-kat'],
|
['red', 'rectangle', 50, 'medium', 'Kit-kat'],
|
||||||
['blue', 'rectangle', 115, 'big', 'Wedel'],
|
['blue', 'rectangle', 115, 'big', 'Wedel'],
|
||||||
|
@ -62,15 +62,14 @@ def partition(rows, question):
|
|||||||
|
|
||||||
|
|
||||||
def gini(rows):
|
def gini(rows):
|
||||||
""" Gini impurity is a measure of how often a randomly chosen element from
|
""" Gini impurity to miara tego jak często losowo wybrany element zbioru byłby źle skategoryzowany, gdyby
|
||||||
the set would be incorrectly labeled if it was randomly labeled according to
|
przypisać mu losową kategorię spośród wszystkich kategorii znajdujących się w danym zbiorze. """
|
||||||
the distribution of labels in the subset. """
|
|
||||||
|
|
||||||
counts = class_counts(rows)
|
counts = class_counts(rows)
|
||||||
impurity = 1
|
impurity = 0
|
||||||
for lbl in counts:
|
for lbl in counts:
|
||||||
prob_of_lbl = counts[lbl] / float(len(rows))
|
prob_of_lbl = counts[lbl] / float(len(rows))
|
||||||
impurity -= prob_of_lbl ** 2
|
impurity += prob_of_lbl * (1 - prob_of_lbl)
|
||||||
return impurity
|
return impurity
|
||||||
|
|
||||||
|
|
||||||
@ -169,16 +168,15 @@ def print_leaf(counts):
|
|||||||
# print_tree(my_tree)
|
# print_tree(my_tree)
|
||||||
#
|
#
|
||||||
# testing_data = [
|
# testing_data = [
|
||||||
# ['gold', 'rectangle', 50, 'medium', 'Name'],
|
# ['red', 'rectangle', 50, 'medium', 'Kit-kat'],
|
||||||
# ['brown', 'rectangle', 55, 'medium', 'Snickers'],
|
# ['blue', 'rectangle', 115, 'big', 'Wedel'],
|
||||||
# ['white', 'rectangle', 120, 'big', 'Name']
|
# ['white', 'rectangle', 15, 'small', 'Krowka'],
|
||||||
# ]
|
# ]
|
||||||
#
|
#
|
||||||
# test = ['white', 'rectangle', 120, 'big', 'Name']
|
# test = ['white', 'rectangle', 15, 'small', 'Krowka']
|
||||||
#
|
#
|
||||||
# # for row in testing_data:
|
# for row in testing_data:
|
||||||
# # print(print_leaf(classify(row, my_tree)))
|
# print(print_leaf(classify(row, my_tree)))
|
||||||
#
|
#
|
||||||
# wynik = print_leaf(classify(test, my_tree))[0]
|
# wynik = print_leaf(classify(test, my_tree))[0]
|
||||||
# print(wynik)
|
# print(wynik)
|
||||||
|
|
||||||
|
BIN
environment.yml
BIN
environment.yml
Binary file not shown.
BIN
img/shelf.png
BIN
img/shelf.png
Binary file not shown.
Before Width: | Height: | Size: 691 B After Width: | Height: | Size: 849 B |
2
main.py
2
main.py
@ -11,6 +11,7 @@ from board import create_board, draw_board
|
|||||||
from random import randint, choice
|
from random import randint, choice
|
||||||
from mcda import choseProducts
|
from mcda import choseProducts
|
||||||
|
|
||||||
|
|
||||||
# Inicjalizacja programu i utworzenie obiektu ekrany
|
# Inicjalizacja programu i utworzenie obiektu ekrany
|
||||||
def run():
|
def run():
|
||||||
pygame.init()
|
pygame.init()
|
||||||
@ -44,7 +45,6 @@ def run():
|
|||||||
agent.turn_left()
|
agent.turn_left()
|
||||||
elif event.key == pygame.K_UP:
|
elif event.key == pygame.K_UP:
|
||||||
agent.move_forward(board)
|
agent.move_forward(board)
|
||||||
print(agent.x, agent.y)
|
|
||||||
elif event.key == pygame.K_SPACE:
|
elif event.key == pygame.K_SPACE:
|
||||||
board[9][0].item = choice(data.learning_data)
|
board[9][0].item = choice(data.learning_data)
|
||||||
print("Wybrano: " + board[9][0].item[-1])
|
print("Wybrano: " + board[9][0].item[-1])
|
||||||
|
Loading…
Reference in New Issue
Block a user