let square (x:float) = x * x
square 10.0
// fsharp.formatting // fsharp project scaffold
// 1. promote script to unit test // 2. promote script to documentation // 3. discard :)
// blog post: brandewinder.com/2016/08/06/gradient-boosting-part-1 | |
// https://en.wikipedia.org/wiki/Gradient_boosting#Algorithm | |
(* | |
Exploring the dataset | |
*) | |
#I "./packages/" | |
#r "fsharp.data/lib/net40/fsharp.data.dll" | |
open FSharp.Data |
open System | |
open System.IO | |
let path = @"C:\Users\Mathias\Desktop\day-1-test\day-1\trainingsample.csv" | |
let data0 = File.ReadAllLines path | |
let data1 = | |
data0 |> Array.map (fun line -> line.Split ',') |
let rng = System.Random() | |
// first interpretation: flip coins, | |
// and keep only the ones where heads (=0) | |
// until there is only 1 left. | |
let rec Strategy1 (rolls:int, choices:int list) = | |
match choices with | |
| [] -> failwith "unexpected" | |
| [x] -> rolls, x // only one result left: done | |
| _ -> |
let square (x:float) = x * x
square 10.0
// fsharp.formatting // fsharp project scaffold
// 1. promote script to unit test // 2. promote script to documentation // 3. discard :)
1) editor | |
VSCode + Ionide | |
Bonus: Ionide Paket for package management | |
http://ionide.io/ | |
https://fsprojects.github.io/Paket/ | |
2) presentations |
type Observation = { | |
SearchTerms: string | |
ProductTitle: string | |
} | |
with member this.SearchLength = this.SearchTerms.Length |> float | |
type Relevance = float | |
type Predictor = Observation -> Relevance |
#I "../packages/" | |
#r @"FSharp.Data/lib/net40/FSharp.Data.dll" | |
#r @"StemmersNet/lib/net20/StemmersNet.dll" | |
#r @"FSharp.Collections.ParallelSeq/lib/net40/FSharp.Collections.ParallelSeq.dll" | |
#load "Utilities.fs" | |
open FSharp.Data |
type Program () = | |
let f (x:float) = 2.0 * x + 1.0 | |
member this.Run (x:float) = | |
let result = f x | |
printfn "Result: %.2f" result | |
let program = Program() | |
program.Run(10.0) |