final version
This commit is contained in:
parent
480401f8fd
commit
3a75a149e3
@ -1,7 +1,9 @@
|
||||
from math import dist, sqrt
|
||||
from re import A
|
||||
import pygame
|
||||
from classes import minesweeper, system, bfs
|
||||
from random import randrange
|
||||
from geneticAlgorythm import geneticAligouwu
|
||||
|
||||
class AI:
|
||||
window:system.Window
|
||||
@ -17,11 +19,20 @@ class AI:
|
||||
self.window = window
|
||||
self.current_map = current_map
|
||||
self.saper = saper
|
||||
whereMines = []
|
||||
for encounter in current_map.encounters:
|
||||
whereMines.append((encounter.position_x, encounter.position_y))
|
||||
self.route = geneticAligouwu(whereMines)
|
||||
|
||||
def giveNextDestination(self):
|
||||
x = self.route.pop(0)
|
||||
return x
|
||||
|
||||
|
||||
|
||||
#co ma zrobić tylko na początku
|
||||
def ready(self):
|
||||
self.saper.set_map(self.current_map)
|
||||
|
||||
self.bfs()
|
||||
|
||||
#co ma robić przy każdym FPS'ie
|
||||
@ -84,36 +95,17 @@ class AI:
|
||||
self.saper.move()
|
||||
elif len(self.current_map.encounters)!=0:
|
||||
self.bfs()
|
||||
|
||||
|
||||
|
||||
def bfs(self):
|
||||
def mojafunkcja(ileczasu, jakdaleko, jaktrudno, jakciezko):
|
||||
return ((200-ileczasu)+(200-jakdaleko*10))-jaktrudno*jakciezko
|
||||
|
||||
def fitness(x, y, z, w): #funkcja do ewaluacji
|
||||
ans = mojafunkcja(x, y, z, w)
|
||||
return abs(ans-400)
|
||||
dists = [] # how long way is to all encounters from start([0, 0])
|
||||
ranked = []
|
||||
for encounter in self.current_map.encounters:
|
||||
dists.append(abs(self.saper.position_x - encounter.position_x) + abs(self.saper.position_y - encounter.position_y))
|
||||
|
||||
for a in self.current_map.mines:
|
||||
ranked.append((fitness(a.explosion_timer, (abs(self.saper.position_x - encounter.position_x) + abs(self.saper.position_y - encounter.position_y)), a.difficulty, a.weight), a))
|
||||
ranked.sort() #posortowana lista najlepszych wyborów dla min
|
||||
if ranked:
|
||||
print(ranked[0][0])
|
||||
indx = ranked[0][1].position_x
|
||||
indy = ranked[0][1].position_y
|
||||
else:
|
||||
ind = dists.index(min(dists))
|
||||
indx = self.current_map.encounters[ind].position_x
|
||||
indy = self.current_map.encounters[ind].position_y
|
||||
|
||||
|
||||
|
||||
|
||||
goal_state = [indx, indy]
|
||||
#goal_state = [route[i][0], route[i][1]]
|
||||
goal_stateZ = [5, 5]
|
||||
goal_state = [0,0]
|
||||
goal_stateTemp = self.giveNextDestination()
|
||||
goal_state[0] = goal_stateTemp[0]
|
||||
goal_state[1] = goal_stateTemp[1]
|
||||
print(str(goal_stateZ) + " vs " + str(goal_state))
|
||||
print(f'We go to {goal_state}')
|
||||
|
||||
find_path = bfs.BFS(self.saper, self.window)
|
||||
|
112
geneticAlgorythm.py
Normal file
112
geneticAlgorythm.py
Normal file
@ -0,0 +1,112 @@
|
||||
import random
|
||||
def geneticAligouwu(whereMines):
|
||||
populationSize = 120
|
||||
topSize = 20
|
||||
mutationCount = 5
|
||||
genCount = 500
|
||||
|
||||
def distance(xfrom, yto):
|
||||
#print(xfrom[0],yto[0],xfrom[1],yto[1])
|
||||
return abs(xfrom[0]-yto[0]) + abs(xfrom[1]-yto[1])
|
||||
#distance ^
|
||||
|
||||
def fitness(route):
|
||||
routescore = 0
|
||||
startingPoint = (0,0)
|
||||
routescore += distance(startingPoint, route[0])
|
||||
for i in range(0, len(route)-1):
|
||||
if i != (len(route)-2):
|
||||
routescore += distance(route[i], route[i+1])
|
||||
return routescore
|
||||
#fitness ^
|
||||
|
||||
def evaluation(population):
|
||||
for i in range(0, len(population)):
|
||||
#print(str(population[i]) + " nr: " + str(i))
|
||||
population[i][-1] = fitness(population[i])
|
||||
#evaluation(distance)
|
||||
|
||||
def Davis(p1, p2):
|
||||
child = []
|
||||
childP1 = []
|
||||
childP2 = []
|
||||
|
||||
geneA = int(random.random() * len(p1))
|
||||
geneB = int(random.random() * len(p1))
|
||||
|
||||
start = min(geneA, geneB)
|
||||
end = max(geneA, geneB)
|
||||
|
||||
for i in range(start, end):
|
||||
childP1.append(p1[i])
|
||||
|
||||
childP2 = [item for item in p2 if item not in childP1]
|
||||
|
||||
child = childP1 + childP2
|
||||
return child
|
||||
#breeding
|
||||
|
||||
|
||||
def produceNextGeneration(population):
|
||||
#print(population[0])
|
||||
evaluation(population)
|
||||
population.sort(key=lambda eme: eme[-1])
|
||||
"""tempprintscore = []
|
||||
for i in range(0, 10):
|
||||
tempprintscore.append(population[i][-1])
|
||||
print(tempprintscore)"""
|
||||
#print("Best dist: " + str(population[0][-1]))
|
||||
#sorting sorted
|
||||
|
||||
newGeneration = []
|
||||
for i in range(0,topSize):
|
||||
newGeneration.append(population[i])
|
||||
#print("elite child: " + str(population[i]) + str(i))
|
||||
#elitism
|
||||
for i in range(0, len(population)-topSize):
|
||||
child = Davis(population[i], population[len(population)-i-1])
|
||||
newGeneration.append(child)
|
||||
#print("breed child: " + str(child) + "nr: " + str(i+topSize) + " / " + str(i))
|
||||
#fill rest of generation with breeding
|
||||
for i in range(mutationCount):
|
||||
mO = int(random.random() * len(population))
|
||||
#MutatingOrganism
|
||||
gene1 = int(abs(random.random() * len(newGeneration[mO])-1))
|
||||
gene2 = int(abs(random.random() * len(newGeneration[mO])-1))
|
||||
geneTemp = newGeneration[mO][gene1]
|
||||
newGeneration[mO][gene1] = newGeneration[mO][gene2]
|
||||
newGeneration[mO][gene2] = geneTemp
|
||||
#mutation by swapping mines
|
||||
return newGeneration
|
||||
|
||||
|
||||
def geneticAlgorithm(population, generations):
|
||||
currentBestRoute = []
|
||||
currentHighScore = 9999999999999
|
||||
for i in range(0, generations):
|
||||
population = produceNextGeneration(population)
|
||||
if population[0][-1] < currentHighScore:
|
||||
currentBestRoute = population[0]
|
||||
|
||||
print("Najlepszy dystans: " + str(population[0][-1]) + " / " + str(currentBestRoute[-1]) + " <3")
|
||||
return currentBestRoute
|
||||
|
||||
|
||||
#whereMines = []
|
||||
#for encounter in self.current_map.encounters:
|
||||
# whereMines.append((encounter.position_x, encounter.position_y))
|
||||
#mines(coordinates) ^
|
||||
population = []
|
||||
for i in range(0, populationSize):
|
||||
tempPopulation = random.sample(whereMines, len(whereMines))
|
||||
tempPopulation.append(0)
|
||||
population.append(tempPopulation)
|
||||
#generation
|
||||
####################################################################################
|
||||
|
||||
|
||||
route = geneticAlgorithm(population, genCount)
|
||||
route.pop()
|
||||
#END OF GENETIC ALGORITHM
|
||||
####################################################################################
|
||||
return route
|
@ -1,31 +1,31 @@
|
||||
[
|
||||
{"current_level": 1, "leaf_id": "2ece3328-e767-11ec-802c-4ccc6afd6a08", "parents": "root", "rule": "else: return 'detonate'", "feature_idx": -1, "feature_name": "", "instances": 200, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 1, "leaf_id": "2ececefd-e767-11ec-804a-4ccc6afd6a08", "parents": "root", "rule": "if obj[4]<=80.67436609605278:", "feature_idx": 4, "feature_name": "Random_detonation_chance", "instances": 200, "metric": 0.9964625048848765, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 2, "leaf_id": "2edc6e09-e767-11ec-b67a-4ccc6afd6a08", "parents": "2ececefd-e767-11ec-804a-4ccc6afd6a08", "rule": "else: return 'detonate'", "feature_idx": -1, "feature_name": "", "instances": 161, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 2, "leaf_id": "2edd09e1-e767-11ec-b87c-4ccc6afd6a08", "parents": "2ececefd-e767-11ec-804a-4ccc6afd6a08", "rule": "if obj[2]<=0:", "feature_idx": 2, "feature_name": "Protection_from_defuse", "instances": 161, "metric": 0.9203523274205176, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 3, "leaf_id": "2ee9f96f-e767-11ec-b259-4ccc6afd6a08", "parents": "2edd09e1-e767-11ec-b87c-4ccc6afd6a08", "rule": "else: return 'detonate'", "feature_idx": -1, "feature_name": "", "instances": 135, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 3, "leaf_id": "2eea9544-e767-11ec-9dee-4ccc6afd6a08", "parents": "2edd09e1-e767-11ec-b87c-4ccc6afd6a08", "rule": "if obj[3]<=7:", "feature_idx": 3, "feature_name": "Meters_under_the_ground", "instances": 135, "metric": 0.7364977795505669, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 4, "leaf_id": "2ef42ba3-e767-11ec-99b1-4ccc6afd6a08", "parents": "2eea9544-e767-11ec-9dee-4ccc6afd6a08", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 116, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 4, "leaf_id": "2ef4c777-e767-11ec-8b3d-4ccc6afd6a08", "parents": "2eea9544-e767-11ec-9dee-4ccc6afd6a08", "rule": "if obj[1]<=1997.8794790831414:", "feature_idx": 1, "feature_name": "Year(older_more_difficult)", "instances": 116, "metric": 0.3936164041111624, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 5, "leaf_id": "2efb52ad-e767-11ec-a8d9-4ccc6afd6a08", "parents": "2ef4c777-e767-11ec-8b3d-4ccc6afd6a08", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 97, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 5, "leaf_id": "2efbef9f-e767-11ec-8aeb-4ccc6afd6a08", "parents": "2ef4c777-e767-11ec-8b3d-4ccc6afd6a08", "rule": "if obj[5]<=2:", "feature_idx": 5, "feature_name": "Detonation_power_in_m", "instances": 97, "metric": 0.445693177722561, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "2eff6e8b-e767-11ec-a0f6-4ccc6afd6a08", "parents": "2efbef9f-e767-11ec-8aeb-4ccc6afd6a08", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 65, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "2f003159-e767-11ec-bc64-4ccc6afd6a08", "parents": "2efbef9f-e767-11ec-8aeb-4ccc6afd6a08", "rule": "if obj[0]>3:", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 65, "metric": 0.33352200393097664, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 7, "leaf_id": "2f00315a-e767-11ec-b1ab-4ccc6afd6a08", "parents": "2f003159-e767-11ec-bc64-4ccc6afd6a08", "rule": "return 'defuse'", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 65, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "2f09062d-e767-11ec-bec0-4ccc6afd6a08", "parents": "2efbef9f-e767-11ec-8aeb-4ccc6afd6a08", "rule": "if obj[0]<=3:", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 65, "metric": 0.33352200393097664, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 7, "leaf_id": "2f09062e-e767-11ec-b567-4ccc6afd6a08", "parents": "2f09062d-e767-11ec-bec0-4ccc6afd6a08", "rule": "return 'defuse'", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 65, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 5, "leaf_id": "2f1a3992-e767-11ec-bcb8-4ccc6afd6a08", "parents": "2ef4c777-e767-11ec-8b3d-4ccc6afd6a08", "rule": "if obj[5]>2:", "feature_idx": 5, "feature_name": "Detonation_power_in_m", "instances": 97, "metric": 0.445693177722561, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "2f1df45d-e767-11ec-9b1a-4ccc6afd6a08", "parents": "2f1a3992-e767-11ec-bcb8-4ccc6afd6a08", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 32, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "2f1e9032-e767-11ec-8145-4ccc6afd6a08", "parents": "2f1a3992-e767-11ec-bcb8-4ccc6afd6a08", "rule": "if obj[0]<=7:", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 32, "metric": 0.6252624052234231, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 7, "leaf_id": "2f1e9033-e767-11ec-ae84-4ccc6afd6a08", "parents": "2f1e9032-e767-11ec-8145-4ccc6afd6a08", "rule": "return 'defuse'", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 32, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "2f273cd1-e767-11ec-9821-4ccc6afd6a08", "parents": "2f1a3992-e767-11ec-bcb8-4ccc6afd6a08", "rule": "if obj[0]>7:", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 32, "metric": 0.6252624052234231, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 7, "leaf_id": "2f273cd2-e767-11ec-96af-4ccc6afd6a08", "parents": "2f273cd1-e767-11ec-9821-4ccc6afd6a08", "rule": "return 'defuse'", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 32, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 4, "leaf_id": "2f4108be-e767-11ec-bfcb-4ccc6afd6a08", "parents": "2eea9544-e767-11ec-9dee-4ccc6afd6a08", "rule": "if obj[1]>1997.8794790831414:", "feature_idx": 1, "feature_name": "Year(older_more_difficult)", "instances": 116, "metric": 0.3936164041111624, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 5, "leaf_id": "2f4108bf-e767-11ec-aecd-4ccc6afd6a08", "parents": "2f4108be-e767-11ec-bfcb-4ccc6afd6a08", "rule": "return 'defuse'", "feature_idx": 1, "feature_name": "Year(older_more_difficult)", "instances": 116, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 3, "leaf_id": "2f52d6df-e767-11ec-ac3e-4ccc6afd6a08", "parents": "2edd09e1-e767-11ec-b87c-4ccc6afd6a08", "rule": "if obj[3]>7:", "feature_idx": 3, "feature_name": "Meters_under_the_ground", "instances": 135, "metric": 0.7364977795505669, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 4, "leaf_id": "2f52d6e0-e767-11ec-b6e4-4ccc6afd6a08", "parents": "2f52d6df-e767-11ec-ac3e-4ccc6afd6a08", "rule": "return 'detonate'", "feature_idx": 3, "feature_name": "Meters_under_the_ground", "instances": 135, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 2, "leaf_id": "2f6567d1-e767-11ec-ae72-4ccc6afd6a08", "parents": "2ececefd-e767-11ec-804a-4ccc6afd6a08", "rule": "if obj[2]>0:", "feature_idx": 2, "feature_name": "Protection_from_defuse", "instances": 161, "metric": 0.9203523274205176, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 3, "leaf_id": "2f6567d2-e767-11ec-b1b8-4ccc6afd6a08", "parents": "2f6567d1-e767-11ec-ae72-4ccc6afd6a08", "rule": "return 'detonate'", "feature_idx": 2, "feature_name": "Protection_from_defuse", "instances": 161, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 1, "leaf_id": "2f793070-e767-11ec-9adb-4ccc6afd6a08", "parents": "root", "rule": "if obj[4]>80.67436609605278:", "feature_idx": 4, "feature_name": "Random_detonation_chance", "instances": 200, "metric": 0.9964625048848765, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 2, "leaf_id": "2f793071-e767-11ec-9798-4ccc6afd6a08", "parents": "2f793070-e767-11ec-9adb-4ccc6afd6a08", "rule": "return 'detonate'", "feature_idx": 4, "feature_name": "Random_detonation_chance", "instances": 200, "metric": 0, "return_statement": 1, "tree_id": 0}
|
||||
{"current_level": 1, "leaf_id": "6c32ed43-2efd-11ed-96f6-4ccc6afd6a08", "parents": "root", "rule": "else: return 'detonate'", "feature_idx": -1, "feature_name": "", "instances": 200, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 1, "leaf_id": "6c3375b0-2efd-11ed-a86e-4ccc6afd6a08", "parents": "root", "rule": "if obj[4]<=80.67436609605278:", "feature_idx": 4, "feature_name": "Random_detonation_chance", "instances": 200, "metric": 0.9964625048848765, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 2, "leaf_id": "6c412666-2efd-11ed-9404-4ccc6afd6a08", "parents": "6c3375b0-2efd-11ed-a86e-4ccc6afd6a08", "rule": "else: return 'detonate'", "feature_idx": -1, "feature_name": "", "instances": 161, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 2, "leaf_id": "6c41c121-2efd-11ed-ac61-4ccc6afd6a08", "parents": "6c3375b0-2efd-11ed-a86e-4ccc6afd6a08", "rule": "if obj[2]<=0:", "feature_idx": 2, "feature_name": "Protection_from_defuse", "instances": 161, "metric": 0.9203523274205176, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 3, "leaf_id": "6c4e94d5-2efd-11ed-850f-4ccc6afd6a08", "parents": "6c41c121-2efd-11ed-ac61-4ccc6afd6a08", "rule": "else: return 'detonate'", "feature_idx": -1, "feature_name": "", "instances": 135, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 3, "leaf_id": "6c4f30b9-2efd-11ed-84b6-4ccc6afd6a08", "parents": "6c41c121-2efd-11ed-ac61-4ccc6afd6a08", "rule": "if obj[3]<=7:", "feature_idx": 3, "feature_name": "Meters_under_the_ground", "instances": 135, "metric": 0.7364977795505669, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 4, "leaf_id": "6c58a9a1-2efd-11ed-93df-4ccc6afd6a08", "parents": "6c4f30b9-2efd-11ed-84b6-4ccc6afd6a08", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 116, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 4, "leaf_id": "6c59464a-2efd-11ed-b802-4ccc6afd6a08", "parents": "6c4f30b9-2efd-11ed-84b6-4ccc6afd6a08", "rule": "if obj[1]<=1997.8794790831414:", "feature_idx": 1, "feature_name": "Year(older_more_difficult)", "instances": 116, "metric": 0.3936164041111624, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 5, "leaf_id": "6c5ff8ae-2efd-11ed-b012-4ccc6afd6a08", "parents": "6c59464a-2efd-11ed-b802-4ccc6afd6a08", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 97, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 5, "leaf_id": "6c609493-2efd-11ed-bddd-4ccc6afd6a08", "parents": "6c59464a-2efd-11ed-b802-4ccc6afd6a08", "rule": "if obj[5]<=2:", "feature_idx": 5, "feature_name": "Detonation_power_in_m", "instances": 97, "metric": 0.445693177722561, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "6c641cce-2efd-11ed-853e-4ccc6afd6a08", "parents": "6c609493-2efd-11ed-bddd-4ccc6afd6a08", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 65, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "6c64df99-2efd-11ed-92e7-4ccc6afd6a08", "parents": "6c609493-2efd-11ed-bddd-4ccc6afd6a08", "rule": "if obj[0]>3:", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 65, "metric": 0.33352200393097664, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 7, "leaf_id": "6c64df9a-2efd-11ed-8b1f-4ccc6afd6a08", "parents": "6c64df99-2efd-11ed-92e7-4ccc6afd6a08", "rule": "return 'defuse'", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 65, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "6c6d8c35-2efd-11ed-98ee-4ccc6afd6a08", "parents": "6c609493-2efd-11ed-bddd-4ccc6afd6a08", "rule": "if obj[0]<=3:", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 65, "metric": 0.33352200393097664, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 7, "leaf_id": "6c6d8c36-2efd-11ed-9fff-4ccc6afd6a08", "parents": "6c6d8c35-2efd-11ed-98ee-4ccc6afd6a08", "rule": "return 'defuse'", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 65, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 5, "leaf_id": "6c7e7094-2efd-11ed-8453-4ccc6afd6a08", "parents": "6c59464a-2efd-11ed-b802-4ccc6afd6a08", "rule": "if obj[5]>2:", "feature_idx": 5, "feature_name": "Detonation_power_in_m", "instances": 97, "metric": 0.445693177722561, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "6c81c9ac-2efd-11ed-a8fb-4ccc6afd6a08", "parents": "6c7e7094-2efd-11ed-8453-4ccc6afd6a08", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 32, "metric": 0, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "6c828c78-2efd-11ed-846f-4ccc6afd6a08", "parents": "6c7e7094-2efd-11ed-8453-4ccc6afd6a08", "rule": "if obj[0]<=7:", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 32, "metric": 0.6252624052234231, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 7, "leaf_id": "6c828c79-2efd-11ed-8614-4ccc6afd6a08", "parents": "6c828c78-2efd-11ed-846f-4ccc6afd6a08", "rule": "return 'defuse'", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 32, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 6, "leaf_id": "6c8aeb2a-2efd-11ed-b3e2-4ccc6afd6a08", "parents": "6c7e7094-2efd-11ed-8453-4ccc6afd6a08", "rule": "if obj[0]>7:", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 32, "metric": 0.6252624052234231, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 7, "leaf_id": "6c8aeb2b-2efd-11ed-bc1a-4ccc6afd6a08", "parents": "6c8aeb2a-2efd-11ed-b3e2-4ccc6afd6a08", "rule": "return 'defuse'", "feature_idx": 0, "feature_name": "Size(bigger_more_difficult)", "instances": 32, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 4, "leaf_id": "6ca47c29-2efd-11ed-97d3-4ccc6afd6a08", "parents": "6c4f30b9-2efd-11ed-84b6-4ccc6afd6a08", "rule": "if obj[1]>1997.8794790831414:", "feature_idx": 1, "feature_name": "Year(older_more_difficult)", "instances": 116, "metric": 0.3936164041111624, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 5, "leaf_id": "6ca47c2a-2efd-11ed-9f03-4ccc6afd6a08", "parents": "6ca47c29-2efd-11ed-97d3-4ccc6afd6a08", "rule": "return 'defuse'", "feature_idx": 1, "feature_name": "Year(older_more_difficult)", "instances": 116, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 3, "leaf_id": "6cb56086-2efd-11ed-89bd-4ccc6afd6a08", "parents": "6c41c121-2efd-11ed-ac61-4ccc6afd6a08", "rule": "if obj[3]>7:", "feature_idx": 3, "feature_name": "Meters_under_the_ground", "instances": 135, "metric": 0.7364977795505669, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 4, "leaf_id": "6cb56087-2efd-11ed-ab67-4ccc6afd6a08", "parents": "6cb56086-2efd-11ed-89bd-4ccc6afd6a08", "rule": "return 'detonate'", "feature_idx": 3, "feature_name": "Meters_under_the_ground", "instances": 135, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 2, "leaf_id": "6cc644e4-2efd-11ed-9561-4ccc6afd6a08", "parents": "6c3375b0-2efd-11ed-a86e-4ccc6afd6a08", "rule": "if obj[2]>0:", "feature_idx": 2, "feature_name": "Protection_from_defuse", "instances": 161, "metric": 0.9203523274205176, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 3, "leaf_id": "6cc644e5-2efd-11ed-99f9-4ccc6afd6a08", "parents": "6cc644e4-2efd-11ed-9561-4ccc6afd6a08", "rule": "return 'detonate'", "feature_idx": 2, "feature_name": "Protection_from_defuse", "instances": 161, "metric": 0, "return_statement": 1, "tree_id": 0},
|
||||
{"current_level": 1, "leaf_id": "6cd72945-2efd-11ed-a270-4ccc6afd6a08", "parents": "root", "rule": "if obj[4]>80.67436609605278:", "feature_idx": 4, "feature_name": "Random_detonation_chance", "instances": 200, "metric": 0.9964625048848765, "return_statement": 0, "tree_id": 0},
|
||||
{"current_level": 2, "leaf_id": "6cd72946-2efd-11ed-a940-4ccc6afd6a08", "parents": "6cd72945-2efd-11ed-a270-4ccc6afd6a08", "rule": "return 'detonate'", "feature_idx": 4, "feature_name": "Random_detonation_chance", "instances": 200, "metric": 0, "return_statement": 1, "tree_id": 0}
|
||||
]
|
Loading…
Reference in New Issue
Block a user