przyrost
This commit is contained in:
parent
50b8b85bdc
commit
ecc3534227
BIN
ai-wozek/__pycache__/classes.cpython-311.pyc
Normal file
BIN
ai-wozek/__pycache__/classes.cpython-311.pyc
Normal file
Binary file not shown.
201
ai-wozek/paczki.csv
Normal file
201
ai-wozek/paczki.csv
Normal file
@ -0,0 +1,201 @@
|
||||
Height,Width,Depth,Weight,Damage,Label_State,Content,Value,Acceptance
|
||||
medium,big,medium,medium,yes,no,fruit,cheap,no
|
||||
small,small,small,heavy,no,yes,clothes,cheap,yes
|
||||
medium,big,medium,light,no,yes,car_parts,expensive,yes
|
||||
medium,big,small,heavy,yes,yes,nuclear_waste,expensive,no
|
||||
medium,big,medium,heavy,yes,yes,nuclear_waste,cheap,no
|
||||
big,medium,medium,medium,yes,yes,car_parts,expensive,no
|
||||
big,small,medium,medium,no,yes,fruit,cheap,yes
|
||||
big,small,medium,medium-heavy,no,yes,car_parts,expensive,yes
|
||||
medium,big,medium,medium,no,no,clothes,cheap,no
|
||||
small,big,medium,medium,no,yes,nuclear_waste,expensive,yes
|
||||
medium,medium,small,light,yes,no,clothes,expensive,no
|
||||
big,small,big,medium,no,yes,car_parts,cheap,yes
|
||||
medium,small,small,medium-heavy,yes,no,fruit,expensive,no
|
||||
big,big,medium,heavy,yes,no,fruit,expensive,no
|
||||
big,medium,small,medium-heavy,no,no,fruit,expensive,no
|
||||
medium,medium,big,heavy,no,no,nuclear_waste,cheap,no
|
||||
medium,small,big,medium-heavy,yes,no,car_parts,expensive,no
|
||||
small,medium,medium,light,no,yes,car_parts,expensive,yes
|
||||
medium,small,small,heavy,yes,yes,nuclear_waste,cheap,no
|
||||
small,big,small,medium,yes,yes,car_parts,expensive,no
|
||||
medium,small,big,medium-heavy,no,yes,car_parts,cheap,yes
|
||||
big,medium,medium,medium,yes,no,car_parts,cheap,no
|
||||
big,small,small,medium,no,yes,clothes,expensive,yes
|
||||
medium,big,big,light,yes,no,car_parts,expensive,no
|
||||
medium,big,medium,medium,yes,no,clothes,expensive,no
|
||||
big,big,medium,light,no,no,nuclear_waste,cheap,no
|
||||
big,small,big,medium-heavy,yes,yes,fruit,expensive,no
|
||||
medium,small,small,medium,yes,no,car_parts,cheap,no
|
||||
small,big,big,medium-heavy,no,yes,car_parts,expensive,yes
|
||||
medium,medium,big,medium,yes,yes,car_parts,expensive,no
|
||||
medium,medium,big,light,no,no,fruit,expensive,no
|
||||
medium,medium,medium,medium,no,yes,nuclear_waste,expensive,yes
|
||||
big,small,big,medium-heavy,no,yes,car_parts,cheap,yes
|
||||
medium,medium,big,light,no,yes,clothes,expensive,yes
|
||||
medium,small,small,light,yes,yes,fruit,expensive,no
|
||||
big,medium,medium,light,yes,yes,nuclear_waste,expensive,no
|
||||
big,small,small,medium-heavy,no,no,nuclear_waste,expensive,no
|
||||
big,big,big,medium-heavy,no,yes,fruit,cheap,yes
|
||||
medium,small,small,medium,yes,yes,nuclear_waste,expensive,no
|
||||
small,small,medium,medium-heavy,yes,yes,clothes,cheap,yes
|
||||
big,small,big,medium,no,yes,fruit,cheap,yes
|
||||
medium,small,small,light,yes,yes,nuclear_waste,expensive,no
|
||||
medium,big,big,medium-heavy,no,no,car_parts,cheap,no
|
||||
medium,big,small,light,no,yes,car_parts,expensive,yes
|
||||
small,medium,medium,heavy,yes,yes,fruit,cheap,yes
|
||||
big,small,big,heavy,no,no,clothes,cheap,no
|
||||
big,big,big,heavy,no,yes,car_parts,cheap,yes
|
||||
medium,big,big,light,no,yes,car_parts,cheap,yes
|
||||
small,small,big,light,yes,no,fruit,expensive,no
|
||||
medium,medium,small,medium,yes,yes,clothes,expensive,no
|
||||
small,medium,big,medium,yes,yes,fruit,expensive,no
|
||||
small,big,medium,heavy,yes,yes,clothes,cheap,no
|
||||
small,small,big,heavy,no,no,fruit,expensive,no
|
||||
small,small,big,medium,yes,yes,car_parts,cheap,no
|
||||
small,small,big,medium,yes,no,clothes,expensive,no
|
||||
medium,small,big,light,yes,no,car_parts,cheap,no
|
||||
big,medium,medium,medium,no,yes,nuclear_waste,expensive,yes
|
||||
small,big,small,light,no,no,car_parts,cheap,no
|
||||
medium,medium,big,heavy,yes,no,fruit,expensive,no
|
||||
small,big,small,medium,no,no,fruit,cheap,no
|
||||
big,medium,big,light,yes,yes,nuclear_waste,expensive,no
|
||||
small,medium,big,light,yes,no,clothes,cheap,no
|
||||
medium,small,big,heavy,yes,no,nuclear_waste,cheap,no
|
||||
big,medium,small,medium,yes,no,car_parts,expensive,no
|
||||
big,medium,big,medium,no,no,nuclear_waste,expensive,no
|
||||
medium,big,medium,medium,no,yes,clothes,cheap,yes
|
||||
medium,big,big,light,yes,yes,clothes,cheap,no
|
||||
small,medium,medium,light,yes,no,nuclear_waste,cheap,yes
|
||||
medium,medium,big,medium,yes,no,nuclear_waste,expensive,no
|
||||
small,medium,small,medium-heavy,yes,no,clothes,cheap,yes
|
||||
medium,medium,small,medium-heavy,yes,no,car_parts,expensive,no
|
||||
medium,small,small,light,no,no,car_parts,expensive,no
|
||||
small,medium,medium,light,no,yes,fruit,expensive,yes
|
||||
small,big,big,medium,no,yes,clothes,expensive,yes
|
||||
small,medium,small,heavy,no,no,car_parts,cheap,yes
|
||||
small,big,small,heavy,yes,no,clothes,expensive,no
|
||||
medium,big,big,medium-heavy,yes,no,fruit,expensive,no
|
||||
medium,medium,small,medium-heavy,yes,yes,clothes,expensive,no
|
||||
small,medium,big,medium-heavy,yes,yes,clothes,expensive,no
|
||||
medium,big,medium,heavy,yes,no,clothes,expensive,no
|
||||
medium,medium,small,medium,yes,no,nuclear_waste,expensive,no
|
||||
small,big,medium,medium,no,no,nuclear_waste,cheap,no
|
||||
small,medium,medium,light,yes,yes,car_parts,cheap,yes
|
||||
big,small,small,light,yes,yes,fruit,expensive,no
|
||||
medium,medium,big,heavy,no,yes,clothes,cheap,yes
|
||||
big,small,big,medium-heavy,yes,no,car_parts,expensive,no
|
||||
big,medium,medium,light,yes,no,fruit,expensive,no
|
||||
big,medium,small,medium,yes,yes,clothes,cheap,no
|
||||
medium,medium,small,heavy,no,no,nuclear_waste,cheap,no
|
||||
small,small,big,heavy,yes,no,fruit,cheap,no
|
||||
medium,big,big,heavy,yes,no,car_parts,expensive,no
|
||||
small,small,small,medium,no,yes,clothes,expensive,yes
|
||||
small,big,medium,medium,yes,yes,car_parts,expensive,no
|
||||
big,small,medium,medium-heavy,yes,yes,nuclear_waste,cheap,no
|
||||
medium,small,small,heavy,yes,no,nuclear_waste,expensive,no
|
||||
small,medium,medium,medium,no,yes,clothes,cheap,yes
|
||||
medium,medium,small,medium-heavy,no,yes,fruit,cheap,yes
|
||||
medium,small,big,heavy,yes,yes,fruit,expensive,no
|
||||
big,small,medium,medium,no,yes,nuclear_waste,expensive,yes
|
||||
big,medium,medium,medium-heavy,yes,yes,nuclear_waste,expensive,no
|
||||
big,small,small,light,no,no,clothes,expensive,no
|
||||
medium,medium,medium,medium-heavy,yes,yes,car_parts,cheap,no
|
||||
big,big,big,heavy,no,no,fruit,expensive,no
|
||||
small,big,big,medium-heavy,yes,no,fruit,cheap,no
|
||||
medium,medium,big,medium,yes,yes,fruit,expensive,no
|
||||
big,big,medium,heavy,yes,no,fruit,expensive,no
|
||||
big,small,small,heavy,no,no,fruit,cheap,no
|
||||
medium,medium,big,light,yes,no,clothes,expensive,no
|
||||
big,big,medium,heavy,yes,yes,clothes,expensive,no
|
||||
small,medium,medium,medium-heavy,yes,no,nuclear_waste,expensive,yes
|
||||
medium,medium,medium,medium-heavy,no,yes,fruit,cheap,yes
|
||||
small,small,medium,medium-heavy,yes,yes,car_parts,expensive,yes
|
||||
small,medium,small,heavy,no,yes,fruit,cheap,yes
|
||||
big,small,big,medium-heavy,yes,yes,nuclear_waste,expensive,no
|
||||
medium,medium,big,heavy,yes,yes,nuclear_waste,cheap,no
|
||||
small,big,medium,medium-heavy,yes,yes,clothes,cheap,no
|
||||
big,medium,big,medium,no,yes,car_parts,expensive,yes
|
||||
big,small,big,heavy,no,yes,nuclear_waste,expensive,yes
|
||||
big,small,big,medium-heavy,no,no,nuclear_waste,cheap,no
|
||||
small,medium,medium,light,no,yes,car_parts,expensive,yes
|
||||
big,medium,small,light,yes,yes,nuclear_waste,expensive,no
|
||||
small,medium,big,medium,yes,no,fruit,cheap,no
|
||||
big,small,small,medium-heavy,yes,yes,fruit,cheap,no
|
||||
small,big,small,light,no,yes,fruit,expensive,yes
|
||||
small,big,medium,light,yes,no,clothes,expensive,no
|
||||
big,medium,big,heavy,yes,no,nuclear_waste,cheap,no
|
||||
big,small,small,light,yes,no,car_parts,cheap,no
|
||||
big,small,medium,medium-heavy,yes,no,fruit,cheap,no
|
||||
big,medium,medium,heavy,yes,no,clothes,cheap,no
|
||||
medium,big,big,light,no,no,car_parts,expensive,no
|
||||
big,small,big,light,yes,yes,nuclear_waste,expensive,no
|
||||
medium,small,small,medium-heavy,yes,yes,car_parts,cheap,no
|
||||
small,big,small,heavy,no,yes,nuclear_waste,cheap,yes
|
||||
small,big,big,medium,no,yes,fruit,cheap,yes
|
||||
medium,medium,medium,medium-heavy,no,yes,clothes,expensive,yes
|
||||
big,small,big,light,no,yes,car_parts,expensive,yes
|
||||
medium,medium,medium,heavy,yes,yes,nuclear_waste,cheap,no
|
||||
small,medium,big,heavy,no,no,car_parts,expensive,no
|
||||
big,small,small,medium-heavy,no,no,fruit,cheap,no
|
||||
medium,small,medium,medium-heavy,yes,yes,nuclear_waste,expensive,no
|
||||
small,small,big,light,no,yes,car_parts,expensive,yes
|
||||
medium,big,small,medium-heavy,yes,no,car_parts,cheap,no
|
||||
big,medium,small,medium,no,no,car_parts,cheap,no
|
||||
medium,big,big,light,no,no,clothes,cheap,no
|
||||
big,big,small,medium-heavy,no,yes,nuclear_waste,expensive,yes
|
||||
medium,medium,small,medium-heavy,no,yes,nuclear_waste,cheap,yes
|
||||
small,small,medium,heavy,no,no,nuclear_waste,cheap,yes
|
||||
medium,medium,big,medium-heavy,no,yes,fruit,cheap,yes
|
||||
medium,big,medium,heavy,no,no,nuclear_waste,expensive,no
|
||||
medium,small,big,light,no,yes,car_parts,cheap,yes
|
||||
small,small,small,heavy,yes,yes,clothes,cheap,yes
|
||||
small,small,big,heavy,yes,yes,nuclear_waste,expensive,no
|
||||
medium,big,big,medium,yes,yes,car_parts,expensive,no
|
||||
medium,small,medium,medium,no,no,fruit,expensive,no
|
||||
big,small,small,medium-heavy,no,no,fruit,cheap,no
|
||||
big,medium,small,light,yes,no,nuclear_waste,expensive,no
|
||||
small,medium,small,heavy,yes,yes,fruit,cheap,yes
|
||||
medium,medium,big,medium-heavy,no,yes,nuclear_waste,cheap,yes
|
||||
big,medium,medium,medium,yes,yes,car_parts,cheap,no
|
||||
big,big,small,medium-heavy,yes,yes,nuclear_waste,expensive,no
|
||||
medium,small,medium,light,no,no,clothes,expensive,no
|
||||
big,big,small,medium-heavy,yes,no,nuclear_waste,expensive,no
|
||||
big,big,small,light,yes,no,clothes,cheap,no
|
||||
small,small,medium,medium-heavy,yes,yes,nuclear_waste,cheap,yes
|
||||
small,big,small,medium,no,yes,fruit,expensive,yes
|
||||
big,medium,medium,medium-heavy,yes,no,fruit,cheap,no
|
||||
small,big,small,heavy,no,yes,clothes,expensive,yes
|
||||
big,big,small,heavy,no,yes,clothes,cheap,yes
|
||||
big,medium,small,medium,no,yes,nuclear_waste,expensive,yes
|
||||
small,big,big,light,yes,yes,clothes,expensive,no
|
||||
big,big,medium,medium,no,no,car_parts,cheap,no
|
||||
big,medium,big,light,no,no,car_parts,expensive,no
|
||||
big,small,small,light,no,yes,fruit,expensive,yes
|
||||
small,big,medium,medium-heavy,yes,no,fruit,expensive,no
|
||||
small,big,big,medium,yes,no,clothes,expensive,no
|
||||
medium,small,big,light,yes,no,fruit,expensive,no
|
||||
small,medium,small,medium-heavy,yes,no,nuclear_waste,expensive,yes
|
||||
medium,big,medium,heavy,no,yes,clothes,expensive,yes
|
||||
medium,small,small,medium-heavy,no,no,nuclear_waste,cheap,no
|
||||
small,small,medium,medium-heavy,yes,yes,clothes,expensive,yes
|
||||
small,big,small,medium-heavy,yes,no,clothes,cheap,no
|
||||
big,big,medium,medium,yes,no,fruit,expensive,no
|
||||
small,small,medium,light,yes,no,clothes,cheap,yes
|
||||
small,small,small,medium-heavy,yes,yes,car_parts,expensive,yes
|
||||
big,medium,small,medium,yes,yes,fruit,expensive,no
|
||||
medium,small,big,medium-heavy,no,no,fruit,cheap,no
|
||||
small,big,big,heavy,yes,no,clothes,expensive,no
|
||||
small,medium,medium,medium-heavy,yes,yes,nuclear_waste,cheap,yes
|
||||
big,medium,medium,heavy,no,yes,nuclear_waste,cheap,yes
|
||||
medium,big,big,heavy,yes,no,nuclear_waste,expensive,no
|
||||
medium,medium,small,medium-heavy,no,no,car_parts,cheap,no
|
||||
small,big,big,medium-heavy,yes,no,clothes,expensive,no
|
||||
small,big,big,heavy,no,no,clothes,expensive,no
|
||||
big,big,small,medium,no,no,clothes,expensive,no
|
||||
medium,small,medium,light,no,yes,car_parts,expensive,yes
|
||||
big,medium,big,heavy,yes,yes,car_parts,expensive,no
|
||||
small,big,medium,medium-heavy,no,yes,car_parts,expensive,yes
|
||||
medium,medium,small,medium-heavy,no,yes,fruit,cheap,yes
|
||||
big,small,medium,medium,yes,no,nuclear_waste,expensive,no
|
||||
small,big,small,light,yes,yes,fruit,expensive,no
|
|
@ -6,6 +6,9 @@ import time
|
||||
from collections import deque
|
||||
import heapq
|
||||
from classes import *
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import math
|
||||
|
||||
class Node():
|
||||
def __init__(self,position,rotation,action,parent,cost):
|
||||
@ -330,6 +333,27 @@ def astar(isstate,final):
|
||||
total_cost[successor]=new_cost
|
||||
p=new_cost+distance(successor,final)
|
||||
heapq.heappush(fringe,(p,successor))
|
||||
|
||||
#drzewko
|
||||
tree_data_base = pd.read_csv('paczki.csv')
|
||||
def entropy(data):
|
||||
labels = data.iloc[:, -1] # Ostatnia kolumna zawiera etykiety klas i pomija 1 wiersz bo jest tytulowy
|
||||
counts = labels.value_counts() #tu zlicza wszystkie opcje
|
||||
probabilities = counts / len(labels)
|
||||
entropy = -sum(probabilities * np.log2(probabilities))
|
||||
return entropy
|
||||
|
||||
def information_gain(data, attribute):
|
||||
total_entropy = entropy(data)
|
||||
values = data[attribute].unique() #przypisujemy wszystkie opcje danego atrybutu np wyoski/niski/sredni
|
||||
weighted_entropy = 0
|
||||
for value in values:
|
||||
subset = data[data[attribute] == value] # przypisujesz wszystkie wiersze danego value do subset
|
||||
subset_entropy = entropy(subset)
|
||||
weighted_entropy += (len(subset) / len(data)) * subset_entropy
|
||||
return (total_entropy - weighted_entropy)
|
||||
|
||||
|
||||
|
||||
|
||||
# Main game loop
|
||||
|
Loading…
Reference in New Issue
Block a user