Instantly share code, notes, and snippets.

Deen Abiolasir-deenicus

• Sort options
Last active Dec 29, 2018
Discrete Probability Monad with F# computation Expressions that runs in Fable.
View #Probabilistic Programming in the Browser.md

Discrete Probability Monad with F# computation Expressions that runs in Fable

Copy and paste each part in turn into http://fable.io/repl/. Probabilistic programming part should start around line 220. Should be compatible with almost everything in http://greenteapress.com/wp/think-bayes/

Also provides text histogram plots!

Created Sep 13, 2017
Simple Counter-factual regret minimization example
View cfr.fsx
 open Prelude.Common open System open Prelude.Math open Prelude open SimpleTrees type Node = { regretSum : double [] ; strategySum : double []; }
Created Sep 13, 2017
Regret Minimization on Least Unique Integer Game
View Least Unique Integer Output
 Attempt at Nash GUESS STRATEGY Move | Move Probability ---- | ---------------- 0 | 0.501 1 | 0.251 2 | 0.125 3 | 0.063
Last active Sep 13, 2017
Regret Minimization. Nash Equilibrium for Rock Paper Scissors
View rps output
 STRATEGY VS STATIC ADVERSARY Move | Move Probability -------- | ---------------- Rock | 0 Paper | 1 Scissors | 0 STRATEGY VS STATIC ADVERSARY Player 1 | Player 2 | Prob 1 | Prob 2 | Joint Prob | Player 1 Util | Player 2 Util
Last active Sep 13, 2017
Regret Minimization on Rock, Paper, Scissors (Games with gifts and no gifts)
View rps2 output
 LEARNED STRATEGY Move | Move Probability ---- | ---------------- R | 0 P | 0.999 S | 0 T | 0 LEARNED STRATEGY VS FIXED ADVERSARY
Last active Aug 29, 2015
View livescorexreligious.csv
Algeria 5.86 0.93 Angola 5.09 0.88 Argentina 6.39 0.66 Australia 8.67 0.32 Austria 7.73 0.55 Azerbaijan 5.6 0.495 Bangladesh 5.07 1.0 Belgium 7.51 0.33 Brazil 6.52 0.865 Bulgaria 5.73 0.335
Last active Aug 29, 2015
 open System open FSharp.Data type GplusPost = FSharp.Data.JsonProvider<"gplusposttemplate.json"> type GplusSearch = FSharp.Data.JsonProvider<"gplusSearchTemplate.json"> type GplusCommentList = FSharp.Data.JsonProvider<"gplusCommentListTemplate.json"> let googlePlusFunc key url parse (mapItems) (next) takeAtATime maxtake query = let download token choice = try
Last active Jan 1, 2016
Hyphenation algorithm used by Tex.
View hyphenate.fs
 type HyphTree = | Node of (int [] option) * Map | Empty let insertpattern tree pattern = let chars = pattern |> Seq.filter (Char.IsNumber >> not) |> Seq.toArray let points = Text.RegularExpressions.Regex.Split(pattern, "[.a-z]") |> Array.map (fun c -> let b, i = Int32.TryParse c in if b then int i else 0) let rec bt t = function | i when i = chars.Length -> Node(Some points, Map.empty) | i ->
Last active Dec 18, 2015
This is a very simple chrome plugin that allows latex to render in google plus. Installation is (simple). Download the zipped plugin from google drive [1](exactly same, conveniently packaged), go to extensions, check developer mode, unzip to a folder and click Load Unpacked Extenstion to load the folder [1] clickable link is a comment below.
View jatexgplus.js
 var injectMathJax = document.createElement('script'); var typeSet = document.createElement('script'); var style=document.createElement('style'); //modified: css https://github.com/christianp/mathjax-bookmarklet/blob/master/bookmarklet.js style.innerText = '.MathJax .mn {background: inherit;} .MathJax .mi {color: inherit;} .MathJax .mo {background: inherit;}'; injectMathJax.type = 'text/javascript'; injectMathJax.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
Last active Sep 13, 2017
A hastily constructed script to rank countries according to some criteria and generate an html table.
View worldbank-country-ranking.fs
 open FSharp.Data let data = WorldBankData.GetDataContext() let scoreArr = [| "Household final consumption expenditure per capita (constant 2000 US\$)", (-7.5, 50000.); "Intentional homicides (per 100,000 people)", (-20., 1000.); "Fixed broadband Internet subscribers (per 100 people)", (9.5, 100.); "Burden of customs procedure, WEF (1=extremely inefficient to 7=extremely efficient)", (6., 7.); "CPIA transparency, accountability, and corruption in the public sector rating (1=low to 6=high)", (6., 6.); "GINI index", (-5., 100.);
You can’t perform that action at this time.