| 
									
										
										
										
											2022-04-24 20:44:54 +08:00
										 |  |  | var mujoco_envs = [ | 
					
						
							| 
									
										
										
										
											2021-04-22 12:49:54 +08:00
										 |  |  |     "Ant-v3", | 
					
						
							|  |  |  |     "HalfCheetah-v3", | 
					
						
							|  |  |  |     "Hopper-v3", | 
					
						
							|  |  |  |     "Humanoid-v3", | 
					
						
							|  |  |  |     "InvertedDoublePendulum-v2", | 
					
						
							|  |  |  |     "InvertedPendulum-v2", | 
					
						
							|  |  |  |     "Reacher-v2", | 
					
						
							|  |  |  |     "Swimmer-v3", | 
					
						
							|  |  |  |     "Walker2d-v3", | 
					
						
							|  |  |  | ]; | 
					
						
							| 
									
										
										
										
											2022-04-24 20:44:54 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | var atari_envs = [ | 
					
						
							|  |  |  |     "PongNoFrameskip-v4", | 
					
						
							|  |  |  |     "BreakoutNoFrameskip-v4", | 
					
						
							|  |  |  |     "EnduroNoFrameskip-v4", | 
					
						
							|  |  |  |     "QbertNoFrameskip-v4", | 
					
						
							|  |  |  |     "MsPacmanNoFrameskip-v4", | 
					
						
							|  |  |  |     "SeaquestNoFrameskip-v4", | 
					
						
							|  |  |  |     "SpaceInvadersNoFrameskip-v4", | 
					
						
							|  |  |  | ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function showMujocoEnv(elem) { | 
					
						
							|  |  |  |     var selectEnv = elem.value || mujoco_envs[0]; | 
					
						
							| 
									
										
										
										
											2021-04-22 12:49:54 +08:00
										 |  |  |     var dataSource = { | 
					
						
							|  |  |  |         $schema: "https://vega.github.io/schema/vega-lite/v5.json", | 
					
						
							|  |  |  |         data: { | 
					
						
							| 
									
										
										
										
											2022-04-24 20:44:54 +08:00
										 |  |  |             // url: "/_static/js/mujoco/benchmark/" + selectEnv + "/result.json"
 | 
					
						
							| 
									
										
										
										
											2022-04-24 16:49:40 -04:00
										 |  |  |             url: "/en/master/_static/js/mujoco/benchmark/" + selectEnv + "/result.json" | 
					
						
							| 
									
										
										
										
											2021-04-22 12:49:54 +08:00
										 |  |  |         }, | 
					
						
							|  |  |  |         mark: "line", | 
					
						
							|  |  |  |         height: 400, | 
					
						
							|  |  |  |         width: 800, | 
					
						
							|  |  |  |         params: [{name: "Range", value: 1000000, bind: {input: "range", min: 10000, max: 10000000}}], | 
					
						
							|  |  |  |         transform: [ | 
					
						
							|  |  |  |             {calculate: "datum.rew - datum.rew_std", as: "rew_std0"}, | 
					
						
							|  |  |  |             {calculate: "datum.rew + datum.rew_std", as: "rew_std1"}, | 
					
						
							|  |  |  |             {calculate: "datum.rew + ' ± ' + datum.rew_std", as: "tooltip_str"}, | 
					
						
							|  |  |  |             {filter: "datum.env_step <= Range"}, | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         encoding: { | 
					
						
							|  |  |  |             color: {"field": "Agent", "type": "nominal"}, | 
					
						
							|  |  |  |             x: {field: "env_step", type: "quantitative", title: "Env step"}, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         layer: [{ | 
					
						
							|  |  |  |             "encoding": { | 
					
						
							|  |  |  |                 "opacity": {"value": 0.3}, | 
					
						
							|  |  |  |                 "y": { | 
					
						
							|  |  |  |                     "title": "Return", | 
					
						
							|  |  |  |                     "field": "rew_std0", | 
					
						
							|  |  |  |                     "type": "quantitative", | 
					
						
							|  |  |  |                 }, | 
					
						
							|  |  |  |                 "y2": {"field": "rew_std1"}, | 
					
						
							|  |  |  |                 tooltip: [ | 
					
						
							|  |  |  |                     {field: "env_step", type: "quantitative", title: "Env step"}, | 
					
						
							|  |  |  |                     {field: "Agent", type: "nominal"}, | 
					
						
							|  |  |  |                     {field: "tooltip_str", type: "nominal", title: "Return"}, | 
					
						
							|  |  |  |                 ] | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             "mark": "area" | 
					
						
							|  |  |  |         }, { | 
					
						
							|  |  |  |             "encoding": { | 
					
						
							|  |  |  |                 "y": { | 
					
						
							|  |  |  |                     "field": "rew", | 
					
						
							|  |  |  |                     "type": "quantitative" | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             "mark": "line" | 
					
						
							|  |  |  |         }] | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     vegaEmbed("#vis-mujoco", dataSource); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-04-24 20:44:54 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | function showAtariEnv(elem) { | 
					
						
							|  |  |  |     var selectEnv = elem.value || atari_envs[0]; | 
					
						
							|  |  |  |     var dataSource = { | 
					
						
							|  |  |  |         $schema: "https://vega.github.io/schema/vega-lite/v5.json", | 
					
						
							|  |  |  |         data: { | 
					
						
							|  |  |  |             // url: "/_static/js/atari/benchmark/" + selectEnv + "/result.json"
 | 
					
						
							|  |  |  |             url: "/en/master/_static/js/atari/benchmark/" + selectEnv + "/result.json" | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         mark: "line", | 
					
						
							|  |  |  |         height: 400, | 
					
						
							|  |  |  |         width: 800, | 
					
						
							|  |  |  |         params: [{name: "Range", value: 10000000, bind: {input: "range", min: 10000, max: 10000000}}], | 
					
						
							|  |  |  |         transform: [ | 
					
						
							|  |  |  |             {calculate: "datum.rew - datum.rew_std", as: "rew_std0"}, | 
					
						
							|  |  |  |             {calculate: "datum.rew + datum.rew_std", as: "rew_std1"}, | 
					
						
							|  |  |  |             {calculate: "datum.rew + ' ± ' + datum.rew_std", as: "tooltip_str"}, | 
					
						
							|  |  |  |             {filter: "datum.env_step <= Range"}, | 
					
						
							|  |  |  |         ], | 
					
						
							|  |  |  |         encoding: { | 
					
						
							|  |  |  |             color: {"field": "Agent", "type": "nominal"}, | 
					
						
							|  |  |  |             x: {field: "env_step", type: "quantitative", title: "Env step"}, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         layer: [{ | 
					
						
							|  |  |  |             "encoding": { | 
					
						
							|  |  |  |                 "opacity": {"value": 0.3}, | 
					
						
							|  |  |  |                 "y": { | 
					
						
							|  |  |  |                     "title": "Return", | 
					
						
							|  |  |  |                     "field": "rew_std0", | 
					
						
							|  |  |  |                     "type": "quantitative", | 
					
						
							|  |  |  |                 }, | 
					
						
							|  |  |  |                 "y2": {"field": "rew_std1"}, | 
					
						
							|  |  |  |                 tooltip: [ | 
					
						
							|  |  |  |                     {field: "env_step", type: "quantitative", title: "Env step"}, | 
					
						
							|  |  |  |                     {field: "Agent", type: "nominal"}, | 
					
						
							|  |  |  |                     {field: "tooltip_str", type: "nominal", title: "Return"}, | 
					
						
							|  |  |  |                 ] | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             "mark": "area" | 
					
						
							|  |  |  |         }, { | 
					
						
							|  |  |  |             "encoding": { | 
					
						
							|  |  |  |                 "y": { | 
					
						
							|  |  |  |                     "field": "rew", | 
					
						
							|  |  |  |                     "type": "quantitative" | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }, | 
					
						
							|  |  |  |             "mark": "line" | 
					
						
							|  |  |  |         }] | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |     vegaEmbed("#vis-atari", dataSource); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-22 12:49:54 +08:00
										 |  |  | $(document).ready(function() { | 
					
						
							| 
									
										
										
										
											2022-04-24 20:44:54 +08:00
										 |  |  |     var envMujocoSelect = $("#env-mujoco"); | 
					
						
							|  |  |  |     if (envMujocoSelect.length) { | 
					
						
							|  |  |  |         $.each(mujoco_envs, function(idx, env) {envMujocoSelect.append($("<option></option>").val(env).html(env));}) | 
					
						
							|  |  |  |         showMujocoEnv(envMujocoSelect); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     var envAtariSelect = $("#env-atari"); | 
					
						
							|  |  |  |     if (envAtariSelect.length) { | 
					
						
							|  |  |  |         $.each(atari_envs, function(idx, env) {envAtariSelect.append($("<option></option>").val(env).html(env));}) | 
					
						
							|  |  |  |         showAtariEnv(envAtariSelect); | 
					
						
							| 
									
										
										
										
											2021-04-22 12:49:54 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | }); |