connected neural network with dog/cat model

This commit is contained in:
Maks Kulikowski 2022-05-30 13:11:25 +02:00
parent 204d1ae0b1
commit 34552233fe
13 changed files with 179 additions and 43 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}

BIN
assets/sprites/mines/1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 758 KiB

BIN
assets/sprites/mines/2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -3,6 +3,7 @@ import pygame
from classes import system
from random import randrange
from classes import decisionTrees
from classes.neuralNetwork import NeuralNetwork
pygame.mixer.init()
@ -12,16 +13,18 @@ class NotMine():
position_y: int
size: int
ismine: bool
image_path: str
image: pygame.surface.Surface
font: pygame.font.Font
done_text: pygame.surface.Surface
def __init__(self, position_x, position_y, size, ismine):
def __init__(self, position_x, position_y, size):
self.position_x = position_x
self.position_y = position_y
self.size = size
self.ismine = ismine
self.image = pygame.image.load("assets/sprites/notmines/" + str(randrange(1, 2)) + ".png")
self.ismine = False
self.image_path = "assets/sprites/notmines/" + str(randrange(1, 3)) + ".jpg"
self.image = pygame.image.load(self.image_path)
self.image = pygame.transform.scale(self.image, (self.size, self.size))
self.font = pygame.font.SysFont('Comic Sans MS', int(self.size * 0.3))
self.done_text = self.font.render("", False, (255,0,0))
@ -37,6 +40,7 @@ class Mine():
position_y: int
size: int
ismine: bool
image_path: str
image: pygame.surface.Surface
font: pygame.font.Font
image_text: pygame.surface.Surface
@ -47,15 +51,16 @@ class Mine():
weight: float = 1.0
explosion_timer: int = 100
def __init__(self, position_x, position_y, size, ismine, difficulty=1, weight=1.0, timer=100):
def __init__(self, position_x, position_y, size, difficulty=1, weight=1.0, timer=100):
self.position_x = position_x
self.position_y = position_y
self.size = size
self.ismine = ismine
self.ismine = True
self.weight = weight
self.explosion_timer = timer
self.difficulty = difficulty
self.image = pygame.image.load("assets/sprites/mines/" + str(randrange(1, 2)) + ".png")
self.image_path = "assets/sprites/mines/" + str(randrange(1, 3)) + ".jpg"
self.image = pygame.image.load(self.image_path)
self.image = pygame.transform.scale(self.image, (self.size, self.size))
self.font = pygame.font.SysFont('Comic Sans MS', int(self.size * 0.3))
self.image_text = self.font.render(str(self.weight), False, (255, 0, 0))
@ -192,17 +197,15 @@ class Map:
break
if ok and randrange(10) == 0 and not (i < 2 and j < 3):
#zależnie od wylosowanej liczby mina lub niemina
if randrange(0, 10) > 3:
ismine = True
if randrange(0, 10) > 3: #odpowiednia wartość to > 3
difficulty = randrange(0, 4) + 1
weight = randrange(10, 31) / 10
timer = randrange(100, 200)
mine = Mine(j, i, self.tile_size, ismine, difficulty, weight, timer)
mine = Mine(j, i, self.tile_size, difficulty, weight, timer)
self.mines.append(mine)
self.encounters.append(mine)
else:
ismine = False
notmine = NotMine(j, i, self.tile_size, ismine)
notmine = NotMine(j, i, self.tile_size)
self.notmines.append(notmine)
self.encounters.append(notmine)
@ -304,6 +307,7 @@ class Minesweeper:
self.image = pygame.transform.scale(self.image, (self.size, self.size))
self.rotated_image = self.image
self.rotation_degrees = 0
self.neural_network = NeuralNetwork()
def set_map(self, map: Map):
self.current_map = map
@ -435,8 +439,8 @@ class Minesweeper:
if (self.position_x, self.position_y) == (encounter.position_x, encounter.position_y):
#tutaj będzie sprawdzanie zdjęcia i na podstawie tego przypisywane true albo false do decisionismine
decisionismine = encounter.ismine
decisionismine = self.neural_network.recognize(encounter.image_path)
#wykryto błędnie
if decisionismine != encounter.ismine:
print("ERROR: Decision was not right")
@ -445,6 +449,7 @@ class Minesweeper:
#wykryto poprawnie, że mina
elif decisionismine:
print("Mine? - Yes")
print("")
tree = decisionTrees.DecisionTrees()
decision = tree.return_predict(model)
print("Decision : ", decision, "\n")
@ -457,6 +462,7 @@ class Minesweeper:
#wykryto poprawnie, że niemina
else:
print("Mine? - No")
print("")
encounter.done_text = encounter.font.render("X", False, (255,0,0))
self.current_map.encounters.remove(encounter)
pygame.mixer.Channel(3).set_volume(0.01)

110
classes/neuralNetwork.py Normal file
View File

@ -0,0 +1,110 @@
import pandas as pd
import tensorflow as tf
import numpy as np
import warnings
import os
from keras.utils import load_img
import keras
from sklearn.model_selection import train_test_split
from keras.preprocessing.image import ImageDataGenerator
from keras import Sequential
from keras.layers import Conv2D, MaxPool2D, Flatten, Dense
warnings.filterwarnings('ignore')
create_model = False
learning_sets_path = "data/learning_sets"
save_model_path = "data/models/true_mine_recognizer.model"
load_model_path = "data/models/mine_recognizer.model"
image_size = 128
class NeuralNetwork():
def __init__(self):
if create_model:
input_path = []
label = []
for class_name in os.listdir(learning_sets_path):
for path in os.listdir(learning_sets_path+ "/" +class_name):
if class_name == 'mine':
label.append(0)
else:
label.append(1)
input_path.append(os.path.join(learning_sets_path, class_name, path))
print(input_path[0], label[0])
df = pd.DataFrame()
df['images'] = input_path
df['label'] = label
df = df.sample(frac=1).reset_index(drop=True)
df.head()
df['label'] = df['label'].astype('str')
df.head()
train, test = train_test_split(df, test_size=0.2, random_state=42)
train_generator = ImageDataGenerator(
rescale = 1./255,
rotation_range = 40,
shear_range = 0.2,
zoom_range = 0.2,
horizontal_flip = True,
fill_mode = 'nearest'
)
val_generator = ImageDataGenerator(rescale = 1./255)
train_iterator = train_generator.flow_from_dataframe(
train,
x_col='images',
y_col='label',
target_size=(image_size,image_size),
batch_size=512,
class_mode='binary'
)
val_iterator = val_generator.flow_from_dataframe(
test,
x_col='images',
y_col='label',
target_size=(image_size,image_size),
batch_size=512,
class_mode='binary'
)
self.model = Sequential([
Conv2D(16, (3,3), activation='relu', input_shape=(image_size,image_size,3)),
MaxPool2D((2,2)),
Conv2D(32, (3,3), activation='relu'),
MaxPool2D((2,2)),
Conv2D(64, (3,3), activation='relu'),
MaxPool2D((2,2)),
Flatten(),
Dense(512, activation='relu'),
Dense(1, activation='sigmoid')
])
self.model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
self.model.summary()
self.model.fit(train_iterator, epochs=10, validation_data=val_iterator)
self.model.save(save_model_path)
else:
self.model = keras.models.load_model(load_model_path,
compile=True
)
def recognize(self, image_path):
image = keras.utils.load_img(image_path, target_size=(image_size, image_size))
image_array = keras.utils.img_to_array(image)
image_array = keras.backend.expand_dims(image_array, 0)
prediction = self.model.predict(image_array)
if prediction[0] > 0.5:
predict = "notmine"
accuracy = prediction[0] * 100
elif prediction[0] <= 0.5:
predict = "mine"
accuracy = (1 - prediction[0]) * 100
print("Image: ",image_path," is classified as: ", predict," with: ", accuracy, " accuracy")
if predict == "mine":
return True
else:
return False

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,31 +1,31 @@
[
{"current_level": 1, "leaf_id": "657140df-de8d-11ec-9c63-d43d7ef1576e", "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": "6572790a-de8d-11ec-ac91-d43d7ef1576e", "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": "6581b986-de8d-11ec-9198-d43d7ef1576e", "parents": "6572790a-de8d-11ec-ac91-d43d7ef1576e", "rule": "else: return 'detonate'", "feature_idx": -1, "feature_name": "", "instances": 161, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 2, "leaf_id": "6582f1e8-de8d-11ec-9c53-d43d7ef1576e", "parents": "6572790a-de8d-11ec-ac91-d43d7ef1576e", "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": "65905ed3-de8d-11ec-b36a-d43d7ef1576e", "parents": "6582f1e8-de8d-11ec-9c53-d43d7ef1576e", "rule": "else: return 'detonate'", "feature_idx": -1, "feature_name": "", "instances": 135, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 3, "leaf_id": "659196b8-de8d-11ec-b5e3-d43d7ef1576e", "parents": "6582f1e8-de8d-11ec-9c53-d43d7ef1576e", "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": "659b5a72-de8d-11ec-af31-d43d7ef1576e", "parents": "659196b8-de8d-11ec-b5e3-d43d7ef1576e", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 116, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 4, "leaf_id": "659c924b-de8d-11ec-ba5c-d43d7ef1576e", "parents": "659196b8-de8d-11ec-b5e3-d43d7ef1576e", "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": "65a396a0-de8d-11ec-a956-d43d7ef1576e", "parents": "659c924b-de8d-11ec-ba5c-d43d7ef1576e", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 97, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 5, "leaf_id": "65a4a8a9-de8d-11ec-8c86-d43d7ef1576e", "parents": "659c924b-de8d-11ec-ba5c-d43d7ef1576e", "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": "65a851b0-de8d-11ec-ad73-d43d7ef1576e", "parents": "65a4a8a9-de8d-11ec-8c86-d43d7ef1576e", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 65, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 6, "leaf_id": "65a9899b-de8d-11ec-af58-d43d7ef1576e", "parents": "65a4a8a9-de8d-11ec-8c86-d43d7ef1576e", "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": "65a9899c-de8d-11ec-a96c-d43d7ef1576e", "parents": "65a9899b-de8d-11ec-af58-d43d7ef1576e", "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": "65abfae1-de8d-11ec-aaaa-d43d7ef1576e", "parents": "65a4a8a9-de8d-11ec-8c86-d43d7ef1576e", "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": "65abfae2-de8d-11ec-8f35-d43d7ef1576e", "parents": "65abfae1-de8d-11ec-aaaa-d43d7ef1576e", "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": "65b06753-de8d-11ec-9af2-d43d7ef1576e", "parents": "659c924b-de8d-11ec-ba5c-d43d7ef1576e", "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": "65b41086-de8d-11ec-b9c3-d43d7ef1576e", "parents": "65b06753-de8d-11ec-9af2-d43d7ef1576e", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 32, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 6, "leaf_id": "65b548ec-de8d-11ec-8daf-d43d7ef1576e", "parents": "65b06753-de8d-11ec-9af2-d43d7ef1576e", "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": "65b548ed-de8d-11ec-a6f9-d43d7ef1576e", "parents": "65b548ec-de8d-11ec-8daf-d43d7ef1576e", "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": "65b792b4-de8d-11ec-ae1b-d43d7ef1576e", "parents": "65b06753-de8d-11ec-9af2-d43d7ef1576e", "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": "65b792b5-de8d-11ec-8bb4-d43d7ef1576e", "parents": "65b792b4-de8d-11ec-ae1b-d43d7ef1576e", "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": "65be48e0-de8d-11ec-b4ae-d43d7ef1576e", "parents": "659196b8-de8d-11ec-b5e3-d43d7ef1576e", "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": "65be48e1-de8d-11ec-9136-d43d7ef1576e", "parents": "65be48e0-de8d-11ec-b4ae-d43d7ef1576e", "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": "65c2b4d6-de8d-11ec-89c3-d43d7ef1576e", "parents": "6582f1e8-de8d-11ec-9c53-d43d7ef1576e", "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": "65c2b4d7-de8d-11ec-8575-d43d7ef1576e", "parents": "65c2b4d6-de8d-11ec-89c3-d43d7ef1576e", "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": "65c72151-de8d-11ec-adc4-d43d7ef1576e", "parents": "6572790a-de8d-11ec-ac91-d43d7ef1576e", "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": "65c72152-de8d-11ec-8a44-d43d7ef1576e", "parents": "65c72151-de8d-11ec-adc4-d43d7ef1576e", "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": "65cb8dc2-de8d-11ec-b823-d43d7ef1576e", "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": "65cb8dc3-de8d-11ec-a99c-d43d7ef1576e", "parents": "65cb8dc2-de8d-11ec-b823-d43d7ef1576e", "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": "3da5aae2-e008-11ec-95c1-d43d7ef1576e", "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": "3da6bcfb-e008-11ec-ba71-d43d7ef1576e", "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": "3db49dc5-e008-11ec-b425-d43d7ef1576e", "parents": "3da6bcfb-e008-11ec-ba71-d43d7ef1576e", "rule": "else: return 'detonate'", "feature_idx": -1, "feature_name": "", "instances": 161, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 2, "leaf_id": "3db5af1f-e008-11ec-ba0b-d43d7ef1576e", "parents": "3da6bcfb-e008-11ec-ba71-d43d7ef1576e", "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": "3dc2a6e1-e008-11ec-ba72-d43d7ef1576e", "parents": "3db5af1f-e008-11ec-ba0b-d43d7ef1576e", "rule": "else: return 'detonate'", "feature_idx": -1, "feature_name": "", "instances": 135, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 3, "leaf_id": "3dc39134-e008-11ec-9943-d43d7ef1576e", "parents": "3db5af1f-e008-11ec-ba0b-d43d7ef1576e", "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": "3dcd2d59-e008-11ec-9f6f-d43d7ef1576e", "parents": "3dc39134-e008-11ec-9943-d43d7ef1576e", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 116, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 4, "leaf_id": "3dce17a5-e008-11ec-acb7-d43d7ef1576e", "parents": "3dc39134-e008-11ec-9943-d43d7ef1576e", "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": "3dd4f4e4-e008-11ec-9a04-d43d7ef1576e", "parents": "3dce17a5-e008-11ec-acb7-d43d7ef1576e", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 97, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 5, "leaf_id": "3dd5df33-e008-11ec-a66b-d43d7ef1576e", "parents": "3dce17a5-e008-11ec-acb7-d43d7ef1576e", "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": "3dd9615a-e008-11ec-a021-d43d7ef1576e", "parents": "3dd5df33-e008-11ec-a66b-d43d7ef1576e", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 65, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 6, "leaf_id": "3dda7234-e008-11ec-bf9b-d43d7ef1576e", "parents": "3dd5df33-e008-11ec-a66b-d43d7ef1576e", "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": "3dda7235-e008-11ec-bf80-d43d7ef1576e", "parents": "3dda7234-e008-11ec-bf9b-d43d7ef1576e", "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": "3de6589c-e008-11ec-b9e2-d43d7ef1576e", "parents": "3dd5df33-e008-11ec-a66b-d43d7ef1576e", "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": "3de6589d-e008-11ec-ac82-d43d7ef1576e", "parents": "3de6589c-e008-11ec-b9e2-d43d7ef1576e", "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": "3dfdfd61-e008-11ec-a211-d43d7ef1576e", "parents": "3dce17a5-e008-11ec-acb7-d43d7ef1576e", "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": "3e01a611-e008-11ec-910f-d43d7ef1576e", "parents": "3dfdfd61-e008-11ec-a211-d43d7ef1576e", "rule": "else: return 'defuse'", "feature_idx": -1, "feature_name": "", "instances": 32, "metric": 0, "return_statement": 0, "tree_id": 0},
{"current_level": 6, "leaf_id": "3e029055-e008-11ec-94d4-d43d7ef1576e", "parents": "3dfdfd61-e008-11ec-a211-d43d7ef1576e", "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": "3e029056-e008-11ec-80d0-d43d7ef1576e", "parents": "3e029055-e008-11ec-94d4-d43d7ef1576e", "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": "3e0e9dd1-e008-11ec-8ed3-d43d7ef1576e", "parents": "3dfdfd61-e008-11ec-a211-d43d7ef1576e", "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": "3e0e9dd2-e008-11ec-9bd3-d43d7ef1576e", "parents": "3e0e9dd1-e008-11ec-8ed3-d43d7ef1576e", "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": "3e324f8e-e008-11ec-a2cf-d43d7ef1576e", "parents": "3dc39134-e008-11ec-9943-d43d7ef1576e", "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": "3e324f8f-e008-11ec-b0e5-d43d7ef1576e", "parents": "3e324f8e-e008-11ec-a2cf-d43d7ef1576e", "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": "3e4a6970-e008-11ec-82ec-d43d7ef1576e", "parents": "3db5af1f-e008-11ec-ba0b-d43d7ef1576e", "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": "3e4a6971-e008-11ec-b6a1-d43d7ef1576e", "parents": "3e4a6970-e008-11ec-82ec-d43d7ef1576e", "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": "3e625c50-e008-11ec-8286-d43d7ef1576e", "parents": "3da6bcfb-e008-11ec-ba71-d43d7ef1576e", "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": "3e625c51-e008-11ec-bcac-d43d7ef1576e", "parents": "3e625c50-e008-11ec-8286-d43d7ef1576e", "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": "3e7da9c6-e008-11ec-9254-d43d7ef1576e", "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": "3e7da9c7-e008-11ec-81ca-d43d7ef1576e", "parents": "3e7da9c6-e008-11ec-9254-d43d7ef1576e", "rule": "return 'detonate'", "feature_idx": 4, "feature_name": "Random_detonation_chance", "instances": 200, "metric": 0, "return_statement": 1, "tree_id": 0}
]

View File

@ -1,2 +1,4 @@
pygame
chefboost
chefboost
tensorflow #--upgrade
sklearn