extra mode

This commit is contained in:
Sander Land committed 2020-04-11 21:15:55 +02:00
1 parent 6fc6332f9d
commit 259f6a7f2a
3 files changed
+15 -21

No files matched your search

+10 -5
View File
@@ -239,18 +239,23 @@ class EngineControls(GridLayout):
self.show_error(f"could not decode file contents of {file}")
return ""
def _do_analyze_extra(self, sweep):
def _do_analyze_extra(self, mode):
stones = {s.coords for s in self.board.stones}
current_move = self.board.current_move
if not current_move.analysis:
self.info.text = "Wait for initial analysis to complete before doing a board-sweep or refinement"
return
played_moves = self.board.moves
if sweep:
if mode == "extra":
visits = sum([d["visits"] for d in current_move.analysis]) + self.visits[0][1]
self.info.text = f"Performing additional analysis to {visits} visits"
self._request_analysis(current_move, visits=visits)
return
elif mode == "sweep":
analyze_moves = [Move(coords=(x, y)).gtp() for x in range(self.board_size) for y in range(self.board_size) if (x, y) not in stones]
visits = self.visits[self.ai_fast.active][2]
self.info.text = f"Refining analysis of entire board to {visits} visits"
else:
else: # mode=='refine':
analyze_moves = [a["move"] for a in current_move.analysis]
visits = current_move.analysis[0]["visits"] + self.visits[1][2]
self.info.text = f"Refining analysis of candidate moves to {visits} visits"
@@ -340,12 +345,12 @@ class EngineControls(GridLayout):
else: # early on / root / etc
self.outstanding_analysis_queries.append(copy.copy(query))
def _request_analysis(self, move, faster=False):
def _request_analysis(self, move, faster=False, visits=0):
faster_fac = 5 if faster else 1
move_id = move.id
moves = self.board.moves
fast = self.ai_fast.active
query = {"id": str(move_id), "moves": [[m.bw_player(), m.gtp()] for m in moves], "includeOwnership": True, "maxVisits": self.visits[fast][1] // faster_fac}
query = {"id": str(move_id), "moves": [[m.bw_player(), m.gtp()] for m in moves], "includeOwnership": True, "maxVisits": max(visits, self.visits[fast][1] // faster_fac)}
if self.debug:
print(f"sending query for move {move_id}: {str(query)[:80]}")
self._send_analysis_query(query)
+5 -3
View File
@@ -216,13 +216,15 @@ class KaTrainGui(BoxLayout):
elif keycode[1] == "left":
self.controls.action("redo-branch", -1)
elif keycode[1] == "s":
self.controls.action("analyze-extra", True)
self.controls.action("analyze-extra", "sweep")
elif keycode[1] == "x":
self.controls.action("analyze-extra", "extra")
elif keycode[1] == "r":
self.controls.action("analyze-extra", False)
self.controls.action("analyze-extra", "refine")
elif keycode[1] == "a":
if not self.controls.ai_thinking:
self.controls.ai_move.trigger_action(duration=0)
elif keycode[1] == "p":# TODO: clean repetitive shortcuts
elif keycode[1] == "p": # TODO: clean repetitive shortcuts
self.controls.play.trigger_action(duration=0)
elif keycode[1] == "f":
self.controls.ai_fast.label.trigger_action(duration=0)
-13
View File
@@ -1,13 +0,0 @@
logs.append([{'lcb': 0.9866929576961049, 'move': 'Q13', 'order': 2, 'prior': 0.11910770833492279, 'pv': ['Q13', 'R13', 'S12', 'J1', 'M1', 'G16'], 'scoreLead': 124.47271696460673, 'scoreMean': 126.27482461531041, 'scoreSelfplay': 122.06720914951835, 'scoreStdev': 27.614507025114275, 'utility': 1.1346133945628056, 'utilityLcb': 1.098224634752818, 'visits': 68, 'winrate': 0.9996889433425291, 'outdatedScoreLead': 127.91250052175701, 'evaluation': 0.6566815927216013}])
logs.append([{'lcb': 0.23000714901044894, 'move': 'A7', 'order': 2, 'prior': 0.0939372107386589, 'pv': ['A7', 'B4', 'B3', 'B7', 'G12', 'G10', 'H10', 'G9'], 'scoreLead': -9.121776796888566, 'scoreMean': -4.895108362277802, 'scoreSelfplay': -5.2100667634473705, 'scoreStdev': 21.56650224292897, 'utility': -0.4353121358045132, 'utilityLcb': -0.6303358573690578, 'visits': 97, 'winrate': 0.2996584781406435, 'evaluation': 0.9730087446544682, 'outdatedScoreLead': -4.895108362277802}])
logs.append([{'lcb': 0.48324174996112224, 'move': 'F10', 'order': 2, 'prior': 0.12889033555984497, 'pv': ['F10', 'B9', 'A10', 'A9', 'B9', 'B7', 'H17'], 'scoreLead': 0.7020370412502724, 'scoreMean': 3.1918735507436278, 'scoreSelfplay': 3.8505667580252867, 'scoreStdev': 22.209495140940156, 'utility': 0.18945409233268506, 'utilityLcb': -0.12664315194471099, 'visits': 33, 'winrate': 0.5961336229173351, 'evaluation': 0.9857626433435042, 'outdatedScoreLead': 3.1918735507436278}])
logs.append([{'lcb': 1.2961580404924993, 'move': 'B8', 'order': 4, 'prior': 0.18784967064857483, 'pv': ['B8', 'D10', 'D11', 'G12', 'C14', 'B12'], 'scoreLead': 39.980447187304534, 'scoreMean': 16.300339300165696, 'scoreSelfplay': 16.75147660635949, 'scoreStdev': 27.816062826637406, 'utility': 0.6706339164931426, 'utilityLcb': 2.134771010104406, 'visits': 11, 'winrate': 0.7732519356313338, 'evaluation': 0.465537391117901, 'outdatedScoreLead': 16.300339300165696}])
logs.append([{'lcb': -0.9128409039094549, 'move': 'F6', 'order': 7, 'prior': 0.006048424169421196, 'pv': ['F6', 'E6'], 'scoreLead': -16.519556878825906, 'scoreMean': -14.270362377166748, 'scoreSelfplay': -14.119140625, 'scoreStdev': 19.22452345556336, 'utility': -0.8780453309766154, 'utilityLcb': -2.8000000000000003, 'visits': 2, 'winrate': 0.08715909609054506, 'evaluation': 1.0506796226282822, 'outdatedScoreLead': -14.270362377166748}])
logs.append([{'lcb': -0.11179767394897855, 'move': 'C8', 'order': 4, 'prior': 0.029647205024957657, 'pv': ['C8', 'A9', 'A10', 'A8', 'A7', 'B7', 'B9'], 'scoreLead': -27.91700043151085, 'scoreMean': -21.906844603223075, 'scoreSelfplay': -21.44171085687105, 'scoreStdev': 22.73403649360621, 'utility': -0.9781789774390067, 'utilityLcb': -1.4388028521708551, 'visits': 10, 'winrate': 0.05271085274096721, 'evaluation': 0.925279362535498, 'outdatedScoreLead': -21.906844603223075}])
logs.append([{'lcb': 0.004716111156360503, 'move': 'A8', 'order': 1, 'prior': 0.26070424914360046, 'pv': ['A8', 'A10', 'A6', 'B9', 'A9', 'C8', 'B9', 'C14'], 'scoreLead': -29.377870307329598, 'scoreMean': -25.069371462858335, 'scoreSelfplay': -24.13833752712488, 'scoreStdev': 19.46618456676441, 'utility': -1.0407429104348054, 'utilityLcb': -1.140719563219286, 'visits': 112, 'winrate': 0.0404220585793893, 'evaluation': 0.6556051615755801, 'outdatedScoreLead': -25.069371462858335}])
logs.append([{'lcb': 0.14960351964179275, 'move': 'C8', 'order': 2, 'prior': 0.29037389159202576, 'pv': ['C8', 'B9', 'A10', 'A3', 'A6', 'A4', 'A11', 'A9'], 'scoreLead': -13.234832497594427, 'scoreMean': -19.963710264718976, 'scoreSelfplay': -18.960616476623688, 'scoreStdev': 20.125619040929173, 'utility': -0.8869855532624162, 'utilityLcb': -0.710554899867088, 'visits': 64, 'winrate': 0.0865925720006041, 'evaluation': 0.7800065883824968, 'outdatedScoreLead': -19.963710264718976}])
logs.append([{'lcb': 0.2780396932369631, 'move': 'C14', 'order': 2, 'prior': 0.11985918134450912, 'pv': ['C14', 'A3', 'A6', 'A4', 'A10', 'G8', 'B12', 'F5', 'A11'], 'scoreLead': -6.718795563515677, 'scoreMean': -15.893474225710637, 'scoreSelfplay': -15.203650210809267, 'scoreStdev': 22.044457012561093, 'utility': -0.6851691288815772, 'utilityLcb': -0.422485576723899, 'visits': 122, 'winrate': 0.18422413889493516, 'evaluation': 1.0768651808168639, 'outdatedScoreLead': -15.893474225710637}])
logs.append([{'lcb': -0.04419652907096561, 'move': 'A6', 'order': 1, 'prior': 0.25112441182136536, 'pv': ['A6', 'B2', 'C2', 'A3', 'B1', 'A2', 'C1', 'D10'], 'scoreLead': -30.647512138007034, 'scoreMean': -22.862077390041346, 'scoreSelfplay': -21.523760459148246, 'scoreStdev': 22.10661200254798, 'utility': -0.8707647010387976, 'utilityLcb': -1.2786073140053726, 'visits': 35, 'winrate': 0.10146154698852561, 'evaluation': 0.5179365909169477, 'outdatedScoreLead': -22.862077390041346}])
logs.append([{'lcb': -0.04419652907096561, 'move': 'A6', 'order': 1, 'prior': 0.25112441182136536, 'pv': ['A6', 'B2', 'C2', 'A3', 'B1', 'A2', 'C1', 'D10'], 'scoreLead': -30.647512138007034, 'scoreMean': -22.862077390041346, 'scoreSelfplay': -21.523760459148246, 'scoreStdev': 22.10661200254798, 'utility': -0.8707647010387976, 'utilityLcb': -1.2786073140053726, 'visits': 35, 'winrate': 0.10146154698852561, 'evaluation': 0.2362162847661815, 'outdatedScoreLead': -22.862077390041346}])
logs.append([{'lcb': 1.054309982706412, 'move': 'A11', 'order': 7, 'prior': 0.2366078794002533, 'pv': ['A11', 'A4', 'R9', 'D5', 'Q10'], 'scoreLead': 6.910397638811527, 'scoreMean': 4.639930709907449, 'scoreSelfplay': 5.535607733520525, 'scoreStdev': 15.874905556161806, 'utility': 0.6591456525404961, 'utilityLcb': 1.379769560744805, 'visits': 12, 'winrate': 0.7969443012048731, 'evaluation': 0.28741264032782, 'outdatedScoreLead': 4.639930709907449}])
logs.append([{'lcb': 1.006487464714684, 'move': 'H11', 'order': 2, 'prior': 0.2041485607624054, 'pv': ['H11', 'G10', 'H7', 'H1', 'G2', 'K2'], 'scoreLead': 52.47195084132946, 'scoreMean': 46.81754482750254, 'scoreSelfplay': 46.92620595873263, 'scoreStdev': 27.67551678483527, 'utility': 1.067884055424014, 'utilityLcb': 1.1097375772381621, 'visits': 24, 'winrate': 0.9915397783524882, 'outdatedScoreLead': 45.208157412185365}])