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 :)
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 |
open System.IO | |
type Image = int [] | |
type Observation = { Label:int; Pixels:Image } | |
type Model = Image -> int | |
let euclDistance (img1:Image) (img2:Image) = | |
(img1,img2) ||> Seq.map2 (fun x y -> (x-y) * (x-y)) |> Seq.sum | |
let train trainingSet = |
let source = __SOURCE_DIRECTORY__ | |
#load "NaiveBayes.fs" | |
open MachineLearning.NaiveBayes | |
open System | |
open System.IO | |
open System.Text | |
open System.Text.RegularExpressions |
#r @"..\packages\R.NET.1.5.5\lib\net40\RDotNet.dll" | |
#r @"..\packages\RDotNet.FSharp.0.1.2.1\lib\net40\RDotNet.FSharp.dll" | |
#r @"..\packages\R.NET.1.5.5\lib\net40\RDotNet.NativeLibrary.dll" | |
#r @"..\packages\RProvider.1.0.2\lib\RProvider.dll" | |
open System | |
open RDotNet | |
open RProvider | |
open RProvider.``base`` |
Quickstart: Creating Charts | |
One of the compelling features of R is its ability to create beautiful charts. | |
With the R Type Provider, you can use all of R capabilities from F#, and create simple charts quickly to explore and visualize your data on-the-fly, as well as generate publication quality graphics that can be exported to virtually any format. | |
Charts Basics | |
Basic charts can be found in the graphics package. Assuming you installed the R Type Provider in your project from NuGet, you can reference the required libraries and packages this way: |
This dojo is directly inspired by the Digit Recognizer competition from Kaggle.com: | |
http://www.kaggle.com/c/digit-recognizer | |
The datasets below are simply shorter versions of the training dataset from Kaggle. | |
The dataset | |
************* | |
2 datasets can be downloaded here: |