From 1ad8c606557cd09815bd14f422c0b7d674874d17 Mon Sep 17 00:00:00 2001 From: Varuna Jayasiri Date: Mon, 21 Jun 2021 18:32:48 +0530 Subject: [PATCH] cfr loop --- docs/cfr/index.html | 45 ++++++++++++++++++++-------------------- docs/cfr/kuhn/index.html | 2 +- docs/sitemap.xml | 16 +++++++------- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/docs/cfr/index.html b/docs/cfr/index.html index b4004328..45bb9fa3 100644 --- a/docs/cfr/index.html +++ b/docs/cfr/index.html @@ -1374,7 +1374,7 @@ T \color{orange}{R^T_i(I, a)} &=

Loop for epochs times

-
683        for t in monit.loop(self.epochs):
+
683        for t in monit.iterate('Train', self.epochs):
@@ -1397,8 +1397,9 @@ T \color{orange}{R^T_i(I, a)} &=

Track data for analytics

-
689            self.tracker(self.info_sets)
-690            tracker.save()
+
689            tracker.add_global_step()
+690            self.tracker(self.info_sets)
+691            tracker.save()
@@ -1409,9 +1410,8 @@ T \color{orange}{R^T_i(I, a)} &=

Save checkpoints every $1,000$ iterations

-
693            if (t + 1) % 1_000 == 0:
-694                experiment.save_checkpoint()
-695                tracker.new_line()
+
694            if (t + 1) % 1_000 == 0:
+695                experiment.save_checkpoint()
@@ -1480,15 +1480,14 @@ T \color{orange}{R^T_i(I, a)} &=
-
719        with monit.section("Track"):
-720            for I in info_sets.values():
-721                avg_strategy = I.get_average_strategy()
-722                for a in I.actions():
-723                    tracker.add({
-724                        f'strategy.{I.key}.{a}': I.strategy[a],
-725                        f'average_strategy.{I.key}.{a}': avg_strategy[a],
-726                        f'regret.{I.key}.{a}': I.regret[a],
-727                    })
+
719        for I in info_sets.values():
+720            avg_strategy = I.get_average_strategy()
+721            for a in I.actions():
+722                tracker.add({
+723                    f'strategy.{I.key}.{a}': I.strategy[a],
+724                    f'average_strategy.{I.key}.{a}': avg_strategy[a],
+725                    f'regret.{I.key}.{a}': I.regret[a],
+726                })
@@ -1499,7 +1498,7 @@ T \color{orange}{R^T_i(I, a)} &=

Configurable CFR module

-
730class CFRConfigs(BaseConfigs):
+
729class CFRConfigs(BaseConfigs):
@@ -1510,9 +1509,9 @@ T \color{orange}{R^T_i(I, a)} &=
-
734    create_new_history: Callable[[], History]
-735    epochs: int = 1_00_000
-736    cfr: CFR = 'simple_cfr'
+
733    create_new_history: Callable[[], History]
+734    epochs: int = 1_00_000
+735    cfr: CFR = 'simple_cfr'
@@ -1523,8 +1522,8 @@ T \color{orange}{R^T_i(I, a)} &=

Initialize CFR algorithm

-
739@option(CFRConfigs.cfr)
-740def simple_cfr(c: CFRConfigs):
+
738@option(CFRConfigs.cfr)
+739def simple_cfr(c: CFRConfigs):
@@ -1535,8 +1534,8 @@ T \color{orange}{R^T_i(I, a)} &=
-
744    return CFR(create_new_history=c.create_new_history,
-745               epochs=c.epochs)
+
743    return CFR(create_new_history=c.create_new_history,
+744               epochs=c.epochs)
diff --git a/docs/cfr/kuhn/index.html b/docs/cfr/kuhn/index.html index 7a379650..76380cd5 100644 --- a/docs/cfr/kuhn/index.html +++ b/docs/cfr/kuhn/index.html @@ -721,7 +721,7 @@ other destinations such as Tensorboard can be relatively time consuming. SQLite is enough for our analytics.

-
235    experiment.create(name='kuhn_poker', writers={'sqlite', 'screen'})
+
235    experiment.create(name='kuhn_poker', writers={'sqlite'})
diff --git a/docs/sitemap.xml b/docs/sitemap.xml index 4aa6e34f..af2a2095 100644 --- a/docs/sitemap.xml +++ b/docs/sitemap.xml @@ -106,21 +106,21 @@ https://nn.labml.ai/gan/stylegan/index.html - 2021-06-19T16:30:00+00:00 + 2021-06-21T16:30:00+00:00 1.00 https://nn.labml.ai/gan/stylegan/readme.html - 2021-06-19T16:30:00+00:00 + 2021-06-21T16:30:00+00:00 1.00 https://nn.labml.ai/gan/stylegan/experiment.html - 2021-06-19T16:30:00+00:00 + 2021-06-21T16:30:00+00:00 1.00 @@ -148,7 +148,7 @@ https://nn.labml.ai/gan/index.html - 2021-06-19T16:30:00+00:00 + 2021-06-21T16:30:00+00:00 1.00 @@ -456,7 +456,7 @@ https://nn.labml.ai/index.html - 2021-06-19T16:30:00+00:00 + 2021-06-21T16:30:00+00:00 1.00 @@ -477,7 +477,7 @@ https://nn.labml.ai/cfr/infoset_saver.html - 2021-06-18T16:30:00+00:00 + 2021-06-21T16:30:00+00:00 1.00 @@ -505,7 +505,7 @@ https://nn.labml.ai/cfr/analytics.html - 2021-06-18T16:30:00+00:00 + 2021-06-21T16:30:00+00:00 1.00 @@ -1002,7 +1002,7 @@ https://nn.labml.ai/transformers/fnet/index.html - 2021-06-19T16:30:00+00:00 + 2021-06-21T16:30:00+00:00 1.00