Skip to content

Instantly share code, notes, and snippets.

View HarryMcCarney's full-sized avatar

Harry McCarney HarryMcCarney

View GitHub Profile
{
"Name": "NE1210-Flows",
"BaseDataSetId": [
"BaseDataSetId",
"a840b2f6-cacb-43ec-9ebf-6ed51f4268ed"
],
"PopulationSize": 6,
"Generations": 4,
"MutationRate": 0.5,
"ReplacementRate": 0.1,
#r "nuget: Graphoscope, 0.2.0"
#r "nuget: Cytoscape.NET, 0.2.0"
#r "nuget: FSharp.Stats, 0.5.0"
#r "nuget: Feliz.ViewEngine, 0.24.0"
#r "nuget: Plotly.NET, 2.0.0"
module GraphGenerators =
open Graphoscope
open Graphoscope.Graph
@HarryMcCarney
HarryMcCarney / Sutil Design Patterns- Child Components.fs
Created December 17, 2024 17:39
Sutil Design Patterns- Child Components.fs
module App
open Sutil
open Sutil.CoreElements
type GlobalState =
{
UserName : string
Age : int
@HarryMcCarney
HarryMcCarney / example.fs
Last active August 9, 2024 13:25
Dynamic store creation with Sutil
namespace HNC4PL
module CouriersPage =
open Sutil
open Sutil.CoreElements
open HNC4PL.Model
open HNC4PL.FormElements
open HNC4PL.Maps
open System
#r "nuget: Feliz.ViewEngine"
#r "nuget: Plotly.NET"
open Feliz.ViewEngine
open System
open System.Diagnostics
open System.IO
open Plotly.NET
#r "nuget: FSharp.FGL, 0.0.4"
#r "nuget: FSharp.FGL.ArrayAdjacencyGraph"
open FSharp.FGL
open FSharp.FGL.ArrayAdjacencyGraph
let vertices =
[ for i=01 to 3 do (i,i) ]
let edges =
//http://allendowney.github.io/ThinkBayes2/chap03.html#the-dice-problem
#r "nuget: FSharp.Stats, 0.4.12-preview.1"
open FSharp.Stats
open FSharp.Stats.Distributions
let normalise (dist: Map<'a, float>) =
let totalProbability = dist |> Map.toSeq |> Seq.sumBy snd
dist |> Map.map (fun k v -> v / totalProbability)
(*
Exercise: In Major League Baseball, most players have a batting average between .200 and .330, which means that their probability of getting a hit is between 0.2 and 0.33.
Suppose a player appearing in their first game gets 3 hits out of 3 attempts. What is the posterior distribution for their probability of getting a hit?
https://colab.research.google.com/github/AllenDowney/ThinkBayes2/blob/master/notebooks/chap04.ipynb#scrollTo=LB4DESMrA0bs
*)
#r "nuget: FSharp.Stats, 0.4.12-preview.1"
#r "nuget: Plotly.NET"
#r "nuget: FSharp.Stats, 0.4.12-preview.1"
#r "nuget: fsharp.data"
#r "nuget: Plotly.NET"
open FSharp.Data
open FSharp.Stats
open FSharp.Stats.Distributions
open Plotly.NET
let normalise (dist: seq<'a * float>) =
// Think Bayes - Allen B. Downey
//Chapter 1 - Probability
#r "nuget: FSharp.Stats, 0.4.12-preview.1"
#r "nuget: fsharp.data"
#r "nuget: Plotly.NET"
open FSharp.Data
open FSharp.Stats