Skip to content

Instantly share code, notes, and snippets.

View jetnew's full-sized avatar
♟️

Jet New jetnew

♟️
View GitHub Profile
@kashif
kashif / cem.md
Last active September 18, 2024 21:33
Cross Entropy Method

Cross Entropy Method

How do we solve for the policy optimization problem which is to maximize the total reward given some parametrized policy?

Discounted future reward

To begin with, for an episode the total reward is the sum of all the rewards. If our environment is stochastic, we can never be sure if we will get the same rewards the next time we perform the same actions. Thus the more we go into the future the more the total future reward may diverge. So for that reason it is common to use the discounted future reward where the parameter discount is called the discount factor and is between 0 and 1.

A good strategy for an agent would be to always choose an action that maximizes the (discounted) future reward. In other words we want to maximize the expected reward per episode.

@branneman
branneman / radicals.json
Created June 9, 2020 12:37
JSON list of 214 Simplified Chinese Radicals, data contains radical number, pinyin, english translation, stroke count
[
{
"id": 1,
"radical": "一",
"pinyin": "yī",
"english": "one",
"strokeCount": 1
},
{
"id": 2,
@rmtbb
rmtbb / ChatGPT Canvas HTML Renderer from Clipboard.url
Last active April 24, 2025 10:07
Bookmarklet that lets you render a full HTML page with any included css and javascript that is currently copied to your clipboard. Also works for SVG code. Useful with ChatGPT Canvas
javascript:(function(){try{navigator.clipboard.readText().then(function(t){if(t){var e=window.open("","_blank","width=800,height=600");e.document.open(),e.document.write(t),e.document.close()}else alert("Clipboard is empty. Please copy some text to the clipboard first.")}).catch(function(t){console.error("Failed to read clipboard contents: ",t),alert("An error occurred while trying to access the clipboard. Please ensure your browser allows clipboard access.")})}catch(t){console.error("An error occurred:",t),alert("An error occurred while trying to open the new window with the clipboard content.")}})();//bookmarklet_title: HTML Preview from Clipboard