Added new model

This commit is contained in:
Magdalena Wilczynska 2019-06-12 10:33:18 +02:00
parent 118a8a1b1d
commit 8ca6b13fb3
6 changed files with 5411 additions and 10 deletions

View File

@ -1 +1 @@
1.0 | F00:0.0 F01:0.0 F02:0.1 F10:0.0 F11:0.0 F12:0.1 F20:0.0 F21:0.1 F30:0.0 F31:0.0 F32:0.1 F40:0.0 F41:0.0 F42:0.1
1.0 | F00:0.0 F01:0.1 F02:0.0 F10:0.1 F12:0.0 F20:0.0 F21:0.1 F22:0.0

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -35,4 +35,4 @@ def generate_dataset(run_count, clear, model_name, learn):
wrap_ex("vw --oaa 5 " + filename + ".txt -f " + model_file)
print("Learning process complete, model saved to " + model_file)
generate_dataset(1000, True, "1k", True)
generate_dataset(100, True, "100", True)

View File

@ -3,7 +3,7 @@ from config import MAP_NAME, GRID_WIDTH, GRID_HEIGHT, GC_X, GC_Y
from VowpalWabbit.VowpalWrapper import wrapper
#const
RADIUS = 2
RADIUS = 1
##
COORDINATES_LIST = []
@ -69,11 +69,8 @@ def generate_input(current_position):
importance = 1.0
label = moves_mapping[MOVES_LIST[i]]
area,importance = get_gc_area(coords, RADIUS)
if importance==None:
if MOVES_LIST[i] == "up" or MOVES_LIST[i] == "down":
importance = 2.0
else:
importance = 1.0
if importance == None:
importance = 1.0
if MOVES_LIST[i] == "pick_garbage":
importance = 5.0
input_line = str(label) + " " + str(importance) + " | "
@ -140,7 +137,7 @@ def check_position(position, i):
def get_predicted_move(position):
input_filename = pass_input(position)
output_filename = "./VowpalWabbit/VowpalDataCache/constant_output.txt"
command = "vw --oaa 5 -i ./VowpalWabbit/VowpalModels/1k.model -t "+input_filename+" -p "+output_filename
command = "vw --oaa 5 -i ./VowpalWabbit/VowpalModels/100.model -t "+input_filename+" -p "+output_filename
print(command)
wrapper.wrap_ex(command)
with open( output_filename, 'r' ) as fout: