#r @"nuget://AForge/2.2.5/lib/AForge.dll"
#r @"nuget://AForge.Neuro/2.2.5/lib/AForge.Neuro.dll"
#r @"nuget://AForge.Math/2.2.5/lib/AForge.Math.dll"
#r @"nuget://AForge.Imaging/2.2.5/lib/AForge.Imaging.dll"
#r @"nuget://Accord/2.10.0.0/lib/Accord.dll"
#r @"nuget://Accord.Math/2.10.0.0/lib/Accord.Math.dll"
#r @"nuget://Accord.Statistics/2.10.0.0/lib/Accord.Statistics.dll"
#r @"nuget://Accord.MachineLearning/2.10.0.0/lib/Accord.MachineLearning.dll"
#r @"nuget://Accord.Imaging/2.10.0.0/lib/Accord.Imaging.dll"
#r @"nuget://Accord.Neuro/2.10.0.0/lib/Accord.Neuro.dll"
#r @"nuget://WriteableBitmapEx/1.0.8/lib/net40/WriteableBitmapEx.Wpf.dll"
   
#r "Tsunami.IDEDesktop.exe"
#r "System.Windows.Forms.DataVisualization.dll"
#r "FSharp.Compiler.Interactive.Settings.dll"
#r "System.Xml"
#r "System.Drawing"
#r "System.Windows.Forms"
#r "System.Xml.Linq"
#r "WindowsBase"
#r "PresentationFramework"
#r "PresentationCore"
#r "System.Xaml"
#r "System.Xml"
#r "System.Xml.Linq"
#r "UIAutomationTypes"

open Accord.Neuro
open Accord.Neuro.Learning
open Accord.Neuro.Networks
open Accord.Neuro.ActivationFunctions
open AForge.Neuro.Learning
open Accord.Statistics.Analysis
open System.Windows.Ink
open System.IO
open System
open System.Threading
open System.Windows.Threading
open System.Net
open System.Xml
open System.Xml.Linq
open System
open System.Windows
open System.Windows.Controls
open System.Windows.Media.Imaging 
open System.Windows.Media 
open Tsunami.IDE.FSharp.Charting

let wc = new WebClient()
let xs = wc.DownloadString(@"http://tsunami.io/data/optdigits-tra.txt").Split([|"\r\n"|], StringSplitOptions.RemoveEmptyEntries)

let (X,y) = 
        [| for i in [0..33..63789] -> ([|for j in i..i+31 do yield! (xs.[j].ToCharArray() |> Array.map (string >> float))|], int xs.[i + 32]) |] 
        |> Array.unzip

(* Initiate Network *)
let dbn = DeepBeliefNetwork(BernoulliFunction(), 1024, 50, 10);

GaussianWeights(dbn).Randomize()
dbn.UpdateVisibleWeights()

(* Hyperparameters *)
let learningRate    = 0.1
let weigthDecay     = 0.001
let momentum        = 0.9
let batchSize       = 100

(* Split training data from testing data *)
let inputs = X |> Seq.take 1000 |> Seq.toArray
let outputs = y |> Seq.take 1000 |> Seq.toArray |> Array.map (fun x -> Array.init 10 (fun i -> if i = x then 1. else 0.))

let testInputs = X |> Seq.skip 1000 |> Seq.toArray
let testActuals = y |> Seq.skip 1000 |> Seq.toArray

// LearnLayerUnsupervised
let learnLayerUnspervised(layer:int,epochs:int) =
    let teacher = new DeepBeliefNetworkLearning(
                    dbn,
                    Algorithm = RestrictedBoltzmannNetworkLearningConfigurationFunction( fun h v i -> new ContrastiveDivergenceLearning(h, v, LearningRate = learningRate, Momentum = 0.5, Decay = weigthDecay) :> IUnsupervisedLearning),
                    LayerIndex = layer
                    )
    let batchCount = max 1 (inputs.Length / batchSize)
        
    // Create mini-batches to speed learning
    let groups = Accord.Statistics.Tools.RandomGroups(inputs.Length,batchCount)
    let batches = Accord.Math.Matrix.Subgroups(inputs,groups)
        
    let layerData = teacher.GetLayerInput(batches)
    let cd = teacher.GetLayerAlgorithm(teacher.LayerIndex) :?> ContrastiveDivergenceLearning

    // Start running the learning procedure
    [| for i in 0..epochs -> 
        if i = 10 then cd.Momentum <- momentum
        teacher.RunEpoch(layerData) / float inputs.Length |]

// LearnLayerSupervised
let learnLayerSupervised(epochs:int) =
        let teacher = DeepNeuralNetworkLearning(
                            dbn, 
                            Algorithm = ActivationNetworkLearningConfigurationFunction((fun ann i -> new ParallelResilientBackpropagationLearning(ann) :> ISupervisedLearning)), 
                            LayerIndex = 1)
        
        let layerData = teacher.GetLayerInput(inputs)
        let errors = [| for i in 0..epochs -> teacher.RunEpoch(layerData,outputs)  |]
        dbn.UpdateVisibleWeights()
        errors

// LearnNetworkSupervised
let learnNetworkSupervised(epochs:int) =
    let teacher = AForge.Neuro.Learning.BackPropagationLearning(dbn, LearningRate = learningRate, Momentum = momentum)
    let errors = [| for i in 0..epochs -> teacher.RunEpoch(inputs,outputs)  |]
    dbn.UpdateVisibleWeights()
    errors

(* This may take a while *)
let errors =
    [|
        yield! learnLayerUnspervised(0,200) 
        yield! learnLayerSupervised(2000)
        yield! learnNetworkSupervised(200)
    |]

(* Display Errors *)
Chart.FastLine(errors |> Array.mapi (fun i x -> (i+1,x))).AndYAxis(Title = "Error", Log = true).AndXAxis(Title="Epochs")

let computeOutput(layer:int) =
    let length = dbn.Layers.[layer].Neurons.Length
    [|for i in 0..length-1 -> dbn.Reconstruct(Array.init length (fun j -> if i = j then 1.0 else 0.0 ), layer)|]

let display() =    
    let display(X:float[][], width:int, height:int, rows:int, columns:int) =    
        let bms = WriteableBitmap((rows*width),(columns*height),72. ,72. ,Media.PixelFormats.Pbgra32,null)
        bms.ForEach(fun x y _ -> 255uy - byte (255. * X.[(y/height) * rows + (x/width)].[(y%height) * width + (x%width)]) |> fun v -> Color.FromRgb(v,v,v))
        Image(Width = float (rows*width), Height = float (columns*height), Source = bms, HorizontalAlignment = HorizontalAlignment.Left)

    let sp = StackPanel(HorizontalAlignment = HorizontalAlignment.Left)    
    let add x = sp.Children.Add(x) |> ignore
    let label x = TextBlock(Text = x, FontSize = 32., Margin = Thickness(10.)) |> add

    label "Layer 2 Weights:"
    add <| display(computeOutput(1),32,32,10,1)

    label "Layer 1 Weights:"
    add <| display(computeOutput(0),32,32,10,5)
            
    label "Training Data:"
    add <| display(X,32,32,40,25)

    ScrollViewer(Content = sp,HorizontalScrollBarVisibility = ScrollBarVisibility.Visible)

Tsunami.IDE.SimpleUI.addControlToNewDocument("Network Weights", fun _ -> display() :> UIElement)

module Array =
    /// returns the index of the max item
    let maxi xs = xs |> Array.mapi (fun i x -> (i,x)) |> Array.maxBy snd |> fst

let predicted = testInputs |> Array.map (fun xs -> dbn.Compute(xs) |> Array.maxi)

let confustionMatrix = (new GeneralConfusionMatrix(10, testActuals, predicted))
printfn "Accuracy: %f" confustionMatrix.OverallAgreement

let interactiveControl() = 
    let inkCanvas = 
        InkCanvas( Width = 200., Height = 200., EditingMode = InkCanvasEditingMode.Ink, 
                        Background = Brushes.White, Opacity = 0.,
                        VerticalAlignment = VerticalAlignment.Top,
                        DefaultDrawingAttributes = DrawingAttributes(Color = Colors.Black, 
                                                                        Width = 30., Height = 30., 
                                                                        FitToCurve = true, 
                                                                        IgnorePressure = true, 
                                                                        StylusTip = StylusTip.Ellipse))

    let ic = Canvas( Width = 200., Height = 200., VerticalAlignment = VerticalAlignment.Top, Background = Brushes.White)

    let inkBmp = WriteableBitmap(32,32,72.,72.,Media.PixelFormats.Pbgra32,null)
    let inkImg = Image(Source = inkBmp, Width = 200., Height = 200.,VerticalAlignment = VerticalAlignment.Top)
    ic.Children.Add(inkImg) |> ignore
    ic.Children.Add(inkCanvas) |> ignore

    let outBmp = WriteableBitmap(32,32,72.,72.,Media.PixelFormats.Pbgra32,null)
    let outImg = Border(BorderBrush = Brushes.LightBlue, BorderThickness = Thickness(4.), 
                        Child = Image(Source = outBmp, Width = 200., Height = 200.,VerticalAlignment = VerticalAlignment.Top),
                         Margin = Thickness(10.), Height = 208., Width = 208.,VerticalAlignment = VerticalAlignment.Top
                        ) 

    let clear = Button(Content = "Clear", Margin = Thickness(10.))
    let predictedOutput = TextBlock()
    let loadRandom = Button(Content = "Load Random", Margin = Thickness(10.))
    let randomInput = TextBlock()
    let rnd = Random()

    let predOut = Array.init 10 (fun _ -> Shapes.Rectangle(Height=0., Width=20.,Fill=Brushes.Blue, VerticalAlignment = VerticalAlignment.Bottom))
    let predGrid = Primitives.UniformGrid(Columns = 10, Rows = 2, Width = 200., Height = 40.)
    predOut |> Array.iter (predGrid.Children.Add >> ignore)
    [|0..9|] |> Array.iter (fun i -> predGrid.Children.Add(TextBlock(HorizontalAlignment = HorizontalAlignment.Center, Text = string i)) |> ignore)

    let updateSparkline(xs:float[]) =
        let max = xs |> Array.maxi
        (xs,predOut) ||> Array.iter2 (fun x pred -> pred.Height <- 20. * x; pred.Fill <- Brushes.Blue)
        predOut.[max].Fill <- Brushes.Green

    loadRandom.Click.Add(fun _ -> 
            let i = rnd.Next(testInputs.Length)
            inkCanvas.Strokes.Clear()
            let is = testInputs.[i]
            let actual = testActuals.[i]
            randomInput.Text <- sprintf "Random Input: %i" actual
            inkBmp.ForEach(fun x y _ -> if is.[y * 32 + x] > 0.5 then Colors.Black else Colors.White)
            let os = dbn.Compute(is)
            updateSparkline(os)
            let rs = dbn.Reconstruct(os)
            let predicted = (os |> Array.maxi)
            outImg.BorderBrush <- if predicted = actual then Brushes.Green else Brushes.Red
            predictedOutput.Text <- sprintf "Predicted Output: %i " predicted
            outBmp.ForEach(fun x y _ -> (1. - rs.[y*32 + x]) * 255. |> byte |> fun v -> Color.FromRgb(v,v,v)) |> ignore
            )

    let recalc() = 
        inkCanvas.Opacity <- 1.
        outImg.BorderBrush <- Brushes.LightBlue
        ic.Measure(Size(200.,200.))
        ic.Arrange(Rect(Size(200.,200.)))
        let rtb = new RenderTargetBitmap(200, 200, 96., 96., PixelFormats.Default);
        rtb.Render(ic)
        ic.Arrange(Rect(Point(4.,4.),Size(200.,200.)))
        let wb = WriteableBitmap(rtb)    
        let input =
            [| 
                for y in [|0..6..186|] do
                    for x in [|0..6..186|] ->
                            if wb.GetPixel(x + 3,y + 3).R > 0uy then 0. else 1.
                
            |] 
        inkBmp.ForEach(fun x y _ -> (1. - input.[y*32 + x]) * 255. |> byte |> fun v -> Color.FromRgb(v,v,v)) |> ignore
        randomInput.Text <- ""
        let os = dbn.Compute(input)
        updateSparkline(os)
        let rs = dbn.Reconstruct(os)
        predictedOutput.Text <-  sprintf "Predicted Output: %i "  (os |> Array.maxi)
        outBmp.ForEach(fun x y _ -> (1. - rs.[y*32 + x]) * 255. |> byte |> fun v -> Color.FromRgb(v,v,v)) |> ignore
        inkCanvas.Opacity <- 0.

    ic.PreviewMouseDown.Add(fun _ -> inkCanvas.Opacity <- 1.)
    ic.MouseUp.Add(fun _ -> recalc())
    inkCanvas.StrokeCollected.Add(fun _ -> recalc())
    clear.Click.Add(fun _ -> inkBmp.Clear(); inkCanvas.Strokes.Clear(); recalc())

    let mainGrid = Grid(Width = 500., Height = 350.)
    mainGrid.ColumnDefinitions.Add(ColumnDefinition())
    mainGrid.ColumnDefinitions.Add(ColumnDefinition())
    mainGrid.RowDefinitions.Add(RowDefinition(Height = GridLength(230.)))
    mainGrid.RowDefinitions.Add(RowDefinition(Height = GridLength(40.)))
    mainGrid.RowDefinitions.Add(RowDefinition(Height = GridLength(40.)))

    let sp = StackPanel()
    [randomInput; predictedOutput] |> Seq.iter (sp.Children.Add >> ignore)
    let sp2 = StackPanel(Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center)
    [|clear; loadRandom |] |> Seq.iter (sp2.Children.Add >> ignore)
    Grid.SetRow(sp,2)
    Grid.SetColumn(sp,1)
    Grid.SetColumn(outImg,1)
    Grid.SetRow(sp2,1)
    Grid.SetRow(predGrid,1)
    Grid.SetColumn(predGrid,1)
    [
        Border(BorderBrush = Brushes.LightBlue, BorderThickness = Thickness(4.), Margin = Thickness(10.), Height = 208., Width = 208., Child = ic,VerticalAlignment = VerticalAlignment.Top) :> UIElement; 
        upcast predGrid; upcast outImg; upcast sp; upcast sp2;
    ] |> Seq.iter (mainGrid.Children.Add >> ignore)
    
    mainGrid
    
Tsunami.IDE.SimpleUI.addControlToNewDocument("Interactive", fun _ -> interactiveControl() :> UIElement)
 
namespace Accord
namespace Accord.Neuro
namespace Accord.Neuro.Learning
namespace Accord.Neuro.Networks
namespace Accord.Neuro.ActivationFunctions
namespace AForge
namespace AForge.Neuro
namespace AForge.Neuro.Learning
namespace Accord.Statistics
namespace Accord.Statistics.Analysis
namespace System
namespace System.Windows
namespace System.Windows.Ink
namespace System.IO
namespace System.Threading
namespace System.Windows.Threading
namespace System.Net
namespace System.Xml
namespace System.Xml.Linq
namespace System.Windows.Controls
namespace System.Windows.Media
namespace System.Windows.Media.Imaging
namespace Tsunami
namespace Tsunami.IDE
namespace Tsunami.IDE.FSharp
module Charting

from Tsunami.IDE.FSharp
val wc : WebClient

Full name: AccordDBN.wc
type WebClient =
inherit Component
new : unit -> WebClient
member AllowReadStreamBuffering : bool with get, set
member AllowWriteStreamBuffering : bool with get, set
member BaseAddress : string with get, set
member CachePolicy : RequestCachePolicy with get, set
member CancelAsync : unit -> unit
member Credentials : ICredentials with get, set
member DownloadData : address:string -> byte[] + 1 overload
member DownloadDataAsync : address:Uri -> unit + 1 overload
member DownloadDataTaskAsync : address:string -> Task<byte[]> + 1 overload
...

Full name: System.Net.WebClient


------
WebClient() : unit
val xs : string []

Full name: AccordDBN.xs
WebClient.DownloadString(address: Uri) : string
WebClient.DownloadString(address: string) : string
type StringSplitOptions =
| None = 0
| RemoveEmptyEntries = 1

Full name: System.StringSplitOptions

Specifies whether applicable Overload:System.String.Split method overloads include or omit empty substrings from the return value.
field StringSplitOptionsRemoveEmptyEntries = 1

The return value does not include array elements that contain an empty string
val X : float [] []

Full name: AccordDBN.X
val y : int []

Full name: AccordDBN.y
val i : int
val j : int
type Array =
member Clone : unit -> obj
member CopyTo : array:Array * index:int -> unit + 1 overload
member GetEnumerator : unit -> IEnumerator
member GetLength : dimension:int -> int
member GetLongLength : dimension:int -> int64
member GetLowerBound : dimension:int -> int
member GetUpperBound : dimension:int -> int
member GetValue : params indices:int[] -> obj + 7 overloads
member Initialize : unit -> unit
member IsFixedSize : bool
...

Full name: System.Array

Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.
val map : mapping:('T -> 'U) -> array:'T [] -> 'U []

Full name: Microsoft.FSharp.Collections.Array.map

Builds a new array whose elements are the results of applying the given function to each of the elements of the array.
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

Converts the argument to a string using ToString.
------
type string = String

Full name: Microsoft.FSharp.Core.string

An abbreviation for the CLI type System.String.
val float : value:'T -> float (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.float

Converts the argument to 64-bit float. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Double.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.
------
type float<'Measure> = float

Full name: Microsoft.FSharp.Core.float<_>

The type of floating point numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to System.Double.
------
type float = Double

Full name: Microsoft.FSharp.Core.float

An abbreviation for the CLI type System.Double.
val int : value:'T -> int (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.int

Converts the argument to signed 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Int32.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.
------
type int<'Measure> = int

Full name: Microsoft.FSharp.Core.int<_>

The type of 32-bit signed integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to System.Int32.
------
type int = int32

Full name: Microsoft.FSharp.Core.int

An abbreviation for the CLI type System.Int32.
val unzip : array:('T1 * 'T2) [] -> 'T1 [] * 'T2 []

Full name: Microsoft.FSharp.Collections.Array.unzip

Splits an array of pairs into two arrays.
val dbn : DeepBeliefNetwork

Full name: AccordDBN.dbn
type DeepBeliefNetwork =
inherit ActivationNetwork
new : inputsCount:int * params hiddenNeurons:int[] -> DeepBeliefNetwork + 2 overloads
member Compute : input:float[] -> float[] + 1 overload
member GenerateInput : output:float[] -> float[]
member GenerateOutput : input:float[] -> float[] + 1 overload
member Machines : IList<RestrictedBoltzmannMachine>
member OutputCount : int
member Pop : unit -> unit
member Push : neurons:int -> unit + 3 overloads
member Reconstruct : output:float[] -> float[] + 1 overload
member Save : stream:Stream -> unit + 1 overload
...

Full name: Accord.Neuro.Networks.DeepBeliefNetwork

Deep Belief Network.
------
DeepBeliefNetwork(inputsCount: int, params hiddenNeurons: int []) : unit
DeepBeliefNetwork(inputsCount: int, params layers: RestrictedBoltzmannMachine []) : unit
DeepBeliefNetwork(function: IStochasticFunction, inputsCount: int, params hiddenNeurons: int []) : unit

Creates a new Accord.Neuro.Networks.DeepBeliefNetwork.
type BernoulliFunction =
new : unit -> BernoulliFunction + 1 overload
member Alpha : float with get, set
member Derivative : x:float -> float
member Derivative2 : y:float -> float
member Function : x:float -> float
member Generate : x:float -> float
member Generate2 : y:float -> float
static member Random : Random with get, set

Full name: Accord.Neuro.ActivationFunctions.BernoulliFunction

Bernoulli stochastic activation function.
------
BernoulliFunction() : unit
BernoulliFunction(alpha: float) : unit

Initializes a new instance of the Accord.Neuro.ActivationFunctions.BernoulliFunction class.
type GaussianWeights =
new : network:ActivationNetwork * ?stdDev:float -> GaussianWeights
member Randomize : unit -> unit + 1 overload
member UpdateThresholds : bool with get, set

Full name: Accord.Neuro.GaussianWeights

Gaussian weight initialization.
------
GaussianWeights(network: AForge.Neuro.ActivationNetwork, ?stdDev: float) : unit

Constructs a new Gaussian Weight Initializer.
DeepBeliefNetwork.UpdateVisibleWeights() : unit

Updates the weights of the visible layers by copying the reverse of the weights in the hidden layers.
val learningRate : float

Full name: AccordDBN.learningRate
val weigthDecay : float

Full name: AccordDBN.weigthDecay
val momentum : float

Full name: AccordDBN.momentum
val batchSize : int

Full name: AccordDBN.batchSize
val inputs : float [] []

Full name: AccordDBN.inputs
module Seq

from Microsoft.FSharp.Collections

Basic operations on IEnumerables.
val take : count:int -> source:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.take

Returns the first N elements of the sequence.

Exceptions:
System.ArgumentNullException
System.ArgumentException
System.InvalidOperationException
val toArray : source:seq<'T> -> 'T []

Full name: Microsoft.FSharp.Collections.Seq.toArray

Builds an array from the given collection.

Exceptions:
System.ArgumentNullException
val outputs : float [] []

Full name: AccordDBN.outputs
val x : int
val init : count:int -> initializer:(int -> 'T) -> 'T []

Full name: Microsoft.FSharp.Collections.Array.init

Creates an array given the dimension and a generator function to compute the elements.
val testInputs : float [] []

Full name: AccordDBN.testInputs
val skip : count:int -> source:seq<'T> -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.skip

Returns a sequence that skips N elements of the underlying sequence and then yields the remaining elements of the sequence.

Exceptions:
System.ArgumentNullException
System.InvalidOperationException
val testActuals : int []

Full name: AccordDBN.testActuals
val learnLayerUnspervised : layer:int * epochs:int -> float []

Full name: AccordDBN.learnLayerUnspervised
val layer : int
val epochs : int
val teacher : DeepBeliefNetworkLearning
type DeepBeliefNetworkLearning =
new : network:DeepBeliefNetwork -> DeepBeliefNetworkLearning
member Algorithm : RestrictedBoltzmannNetworkLearningConfigurationFunction with get, set
member ComputeError : inputs:float[][] -> float
member GetLayerAlgorithm : layerIndex:int -> IUnsupervisedLearning
member GetLayerInput : input:float[][] -> float[][] + 1 overload
member LayerIndex : int with get, set
member Run : input:float[] -> float
member RunEpoch : input:float[][] -> float + 1 overload

Full name: Accord.Neuro.Learning.DeepBeliefNetworkLearning

Deep Belief Network learning algorithm.
------
DeepBeliefNetworkLearning(network: DeepBeliefNetwork) : unit

Creates a new Accord.Neuro.Learning.DeepBeliefNetworkLearning algorithm.
type RestrictedBoltzmannNetworkLearningConfigurationFunction =
delegate of StochasticLayer * StochasticLayer * int -> IUnsupervisedLearning

Full name: Accord.Neuro.Learning.RestrictedBoltzmannNetworkLearningConfigurationFunction

Delegate used to configure and create layer-specific learning algorithms.
val h : Layers.StochasticLayer
val v : Layers.StochasticLayer
type ContrastiveDivergenceLearning =
new : network:RestrictedBoltzmannMachine -> ContrastiveDivergenceLearning + 1 overload
member Decay : float with get, set
member Dispose : unit -> unit
member LearningRate : float with get, set
member Momentum : float with get, set
member Run : input:float[] -> float
member RunEpoch : input:float[][] -> float

Full name: Accord.Neuro.Learning.ContrastiveDivergenceLearning

Contrastive Divergence learning algorithm for Restricted Boltzmann Machines.
------
ContrastiveDivergenceLearning(network: RestrictedBoltzmannMachine) : unit
ContrastiveDivergenceLearning(hidden: Layers.StochasticLayer, visible: Layers.StochasticLayer) : unit

Creates a new Accord.Neuro.Learning.ContrastiveDivergenceLearning algorithm.
type IUnsupervisedLearning =
member Run : input:float[] -> float
member RunEpoch : input:float[][] -> float

Full name: AForge.Neuro.Learning.IUnsupervisedLearning

Unsupervised learning interface.
val batchCount : int
val max : e1:'T -> e2:'T -> 'T (requires comparison)

Full name: Microsoft.FSharp.Core.Operators.max

Maximum based on generic comparison
property Array.Length: int

Gets a 32-bit integer that represents the total number of elements in all the dimensions of the System.Array.
val groups : int []
type Tools =
static member Center : observation:float[] -> unit + 5 overloads
static member ContraHarmonicMean : values:float[] -> float + 1 overload
static member Correlation : matrix:float[,] -> float[,] + 1 overload
static member Covariance : matrix:float[,] -> float[,] + 7 overloads
static member Determination : actual:float[] * expected:float[] -> float
static member DistinctCount : sourceMatrix:float[,] -> int[]
static member Entropy : values:float[] -> float + 6 overloads
static member Expand : classes:int[] -> float[][] + 2 overloads
static member GeometricMean : values:float[] -> float + 1 overload
static member GrandMean : means:float[] * samples:int[] -> float
...

Full name: Accord.Statistics.Tools

Set of statistics functions.
Accord.Statistics.Tools.RandomGroups(size: int, proportion: float) : int []
Accord.Statistics.Tools.RandomGroups(size: int, groups: int) : int []

Returns a random group assignment for a sample into two mutually exclusive groups.
val batches : float [] [] []
namespace Accord.Math
type Matrix =
static member Abs : value:int[] -> int[] + 3 overloads
static member Add : matrix:float[,] * x:float -> float[,] + 7 overloads
static member AddToDiagonal : matrix:float[,] * scalar:float * ?inPlace:bool -> float[,]
static member Apply<'TData, 'TResult> : vector:'TData[] * func:Func<'TData, 'TResult> -> 'TResult[] + 2 overloads
static member ApplyInPlace<'T> : vector:'T[] * func:Func<'T, 'T> -> unit + 3 overloads
static member ApplyWithIndex<'TData, 'TResult> : vector:'TData[] * func:Func<'TData, int, 'TResult> -> 'TResult[] + 1 overload
static member Bottom<'T> : values:'T[] * count:int * ?inPlace:bool -> int[]
static member CartesianProduct<'T> : sequences:IEnumerable<IEnumerable<'T>> -> IEnumerable<IEnumerable<'T>> + 2 overloads
static member Ceiling : matrix:float[,] -> float[,] + 1 overload
static member Centering : size:int -> float[,]
...

Full name: Accord.Math.Matrix

Static class Matrix. Defines a set of extension methods that operates mainly on multidimensional arrays and vectors.
Accord.Math.Matrix.Subgroups<'T>(values: 'T [], groups: int []) : 'T [] []

Returns subgroups extracted from the given vector.
val layerData : float [] [] []
DeepBeliefNetworkLearning.GetLayerInput(batches: float [] [] []) : float [] [] []
DeepBeliefNetworkLearning.GetLayerInput(input: float [] []) : float [] []

Gets the learning data needed to train the Accord.Neuro.Learning.DeepBeliefNetworkLearning.LayerIndex. The return of this function should then be passed to Accord.Neuro.Learning.DeepBeliefNetworkLearning.RunEpoch(System.Double[][]) to actually run a learning epoch.
val cd : ContrastiveDivergenceLearning
DeepBeliefNetworkLearning.GetLayerAlgorithm(layerIndex: int) : IUnsupervisedLearning

Gets the AForge.Neuro.Learning.IUnsupervisedLearning allocated for the given layer.
property DeepBeliefNetworkLearning.LayerIndex: int

Gets or sets the current layer index being trained by the deep learning algorithm.
property ContrastiveDivergenceLearning.Momentum: float

Gets or sets the momentum term of the learning algorithm. Default is 0.9.
DeepBeliefNetworkLearning.RunEpoch(batches: float [] [] []) : float
DeepBeliefNetworkLearning.RunEpoch(input: float [] []) : float

Runs a single learning epoch using multiple mini-batches to improve speed.
val learnLayerSupervised : epochs:int -> float []

Full name: AccordDBN.learnLayerSupervised
val teacher : DeepNeuralNetworkLearning
type DeepNeuralNetworkLearning =
new : network:DeepBeliefNetwork -> DeepNeuralNetworkLearning
member Algorithm : ActivationNetworkLearningConfigurationFunction with get, set
member ComputeError : inputs:float[][] * outputs:float[][] -> float
member GetLayerInput : input:float[][] -> float[][] + 1 overload
member LayerCount : int with get, set
member LayerIndex : int with get, set
member Run : input:float[] * output:float[] -> float
member RunEpoch : input:float[][] * output:float[][] -> float + 1 overload

Full name: Accord.Neuro.Learning.DeepNeuralNetworkLearning

Deep Neural Network learning algorithm.
------
DeepNeuralNetworkLearning(network: DeepBeliefNetwork) : unit

Creates a new Accord.Neuro.Learning.DeepBeliefNetworkLearning algorithm.
type ActivationNetworkLearningConfigurationFunction =
delegate of ActivationNetwork * int -> ISupervisedLearning

Full name: Accord.Neuro.Learning.ActivationNetworkLearningConfigurationFunction

Delegate used to configure and create layer-specific learning algorithms.
val ann : AForge.Neuro.ActivationNetwork
type ParallelResilientBackpropagationLearning =
new : network:ActivationNetwork -> ParallelResilientBackpropagationLearning
member ComputeError : input:float[][] * output:float[][] -> float
member DecreaseFactor : float with get, set
member Dispose : unit -> unit
member IncreaseFactor : float with get, set
member Reset : rate:float -> unit
member Run : input:float[] * output:float[] -> float
member RunEpoch : input:float[][] * output:float[][] -> float
member UpdateLowerBound : float with get, set
member UpdateUpperBound : float with get, set

Full name: Accord.Neuro.Learning.ParallelResilientBackpropagationLearning

Resilient Backpropagation learning algorithm.
------
ParallelResilientBackpropagationLearning(network: AForge.Neuro.ActivationNetwork) : unit

Initializes a new instance of the Accord.Neuro.Learning.ParallelResilientBackpropagationLearning class.
type ISupervisedLearning =
member Run : input:float[] * output:float[] -> float
member RunEpoch : input:float[][] * output:float[][] -> float

Full name: AForge.Neuro.Learning.ISupervisedLearning

Supervised learning interface.
val layerData : float [] []
DeepNeuralNetworkLearning.GetLayerInput(batches: float [] [] []) : float [] [] []
DeepNeuralNetworkLearning.GetLayerInput(input: float [] []) : float [] []

Gets the learning data needed to train the Accord.Neuro.Learning.DeepNeuralNetworkLearning.LayerIndex. The return of this function should then be passed to Accord.Neuro.Learning.DeepNeuralNetworkLearning.RunEpoch(System.Double[][],System.Double[][]) to actually run a learning epoch.
val errors : float []
DeepNeuralNetworkLearning.RunEpoch(inputBatches: float [] [] [], outputBatches: float [] [] []) : float
DeepNeuralNetworkLearning.RunEpoch(input: float [] [], output: float [] []) : float

Runs a single learning epoch using multiple mini-batches to improve speed.
val learnNetworkSupervised : epochs:int -> float []

Full name: AccordDBN.learnNetworkSupervised
val teacher : BackPropagationLearning
type BackPropagationLearning =
new : network:ActivationNetwork -> BackPropagationLearning
member LearningRate : float with get, set
member Momentum : float with get, set
member Run : input:float[] * output:float[] -> float
member RunEpoch : input:float[][] * output:float[][] -> float

Full name: AForge.Neuro.Learning.BackPropagationLearning

Back propagation learning algorithm.
------
BackPropagationLearning(network: AForge.Neuro.ActivationNetwork) : unit

Initializes a new instance of the AForge.Neuro.Learning.BackPropagationLearning class.
BackPropagationLearning.RunEpoch(input: float [] [], output: float [] []) : float

Runs learning epoch.
val errors : float []

Full name: AccordDBN.errors
type Chart =
static member Area : data:IEnumerable<#IConvertible * #IConvertible> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string -> GenericChart
static member Bar : data:IEnumerable<#IConvertible * #IConvertible> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string -> GenericChart
static member BoxPlot : data:seq<IConvertible * #seq<'a1>> * ?Name:string * ?Title:string * ?Labels:'a2 * ?Color:Color * ?XTitle:string * ?YTitle:string * ?Percentile:int * ?ShowAverage:bool * ?ShowMedian:bool * ?ShowUnusualValues:bool * ?WhiskerPercentile:int -> GenericChart (requires 'a1 :> IConvertible)
static member BoxPlot : data:seq<#IConvertible * #IConvertible * #IConvertible * #IConvertible * #IConvertible * #IConvertible> * ?Name:string * ?Title:string * ?Labels:'a6 * ?Color:Color * ?XTitle:string * ?YTitle:string * ?Percentile:int * ?ShowAverage:bool * ?ShowMedian:bool * ?ShowUnusualValues:bool * ?WhiskerPercentile:int -> GenericChart
static member Bubble : data:IEnumerable<#IConvertible * #IConvertible * #IConvertible> * ?Name:string * ?Title:string * ?Labels:#IEnumerable<string> * ?Color:Color * ?XTitle:string * ?YTitle:string * ?BubbleMaxSize:int * ?BubbleMinSize:int * ?BubbleScaleMax:float * ?BubbleScaleMin:float * ?UseSizeForLabel:bool -> GenericChart
static member Candlestick : data:IEnumerable<#IConvertible * #IConvertible * #IConvertible * #IConvertible * #IConvertible> * ?Name:string * ?Title:string * ?Labels:#IEnumerable<string> * ?Color:Color * ?XTitle:string * ?YTitle:string -> CandlestickChart
static member Column : data:IEnumerable<#IConvertible * #IConvertible> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Color * ?XTitle:string * ?YTitle:string -> GenericChart
static member Columns : charts:seq<GenericChart> -> GenericChart
static member Combine : charts:seq<GenericChart> -> GenericChart
static member private ConfigureBoxPlot : c:GenericChart * vPercentile:int option * vShowAverage:bool option * vShowMedian:bool option * vShowUnusualValues:bool option * vWhiskerPercentile:int option -> unit
...

Full name: Tsunami.IDE.FSharp.Charting.Chart
static member Chart.FastLine : data:Collections.Generic.IEnumerable<#IConvertible * #IConvertible> * ?Name:string * ?Title:string * ?Labels:#seq<string> * ?Color:Drawing.Color * ?XTitle:string * ?YTitle:string -> ChartTypes.GenericChart
val mapi : mapping:(int -> 'T -> 'U) -> array:'T [] -> 'U []

Full name: Microsoft.FSharp.Collections.Array.mapi

Builds a new array whose elements are the results of applying the given function to each of the elements of the array. The integer index passed to the function indicates the index of element being transformed.
val x : float
val computeOutput : layer:int -> float [] []

Full name: AccordDBN.computeOutput
val length : int
property AForge.Neuro.Network.Layers: AForge.Neuro.Layer []

Network's layers.
namespace Accord.Neuro.Neurons
DeepBeliefNetwork.Reconstruct(output: float []) : float []
DeepBeliefNetwork.Reconstruct(output: float [], layerIndex: int) : float []

Reconstructs a input vector for a given output.
val display : unit -> ScrollViewer

Full name: AccordDBN.display
val display : (float [] [] * int * int * int * int -> Image)
val X : float [] []
val width : int
val height : int
val rows : int
val columns : int
val bms : WriteableBitmap
type WriteableBitmap =
inherit BitmapSource
new : source:BitmapSource -> WriteableBitmap + 1 overload
member AddDirtyRect : dirtyRect:Int32Rect -> unit
member BackBuffer : nativeint with get, set
member BackBufferStride : int
member Clone : unit -> WriteableBitmap
member CloneCurrentValue : unit -> WriteableBitmap
member Lock : unit -> unit
member TryLock : timeout:Duration -> bool
member Unlock : unit -> unit
member WritePixels : sourceRect:Int32Rect * buffer:nativeint * bufferSize:int * stride:int -> unit + 3 overloads

Full name: System.Windows.Media.Imaging.WriteableBitmap


------
WriteableBitmap(source: BitmapSource) : unit
WriteableBitmap(pixelWidth: int, pixelHeight: int, dpiX: float, dpiY: float, pixelFormat: PixelFormat, palette: BitmapPalette) : unit
namespace System.Windows.Media


------
namespace System.Media
type PixelFormats =
static member Bgr101010 : PixelFormat
static member Bgr24 : PixelFormat
static member Bgr32 : PixelFormat
static member Bgr555 : PixelFormat
static member Bgr565 : PixelFormat
static member Bgra32 : PixelFormat
static member BlackWhite : PixelFormat
static member Cmyk32 : PixelFormat
static member Default : PixelFormat
static member Gray16 : PixelFormat
...

Full name: System.Windows.Media.PixelFormats
property PixelFormats.Pbgra32: PixelFormat
WriteableBitmap.ForEach(func: Func<int,int,Color>) : unit
WriteableBitmap.ForEach(func: Func<int,int,Color,Color>) : unit

Applies the given function to all the pixels of the bitmap in order to set their color.
val y : int
val byte : value:'T -> byte (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.byte

Converts the argument to byte. This is a direct conversion for all primitive numeric types. For strings, the input is converted using Byte.Parse() with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.
------
type byte = Byte

Full name: Microsoft.FSharp.Core.byte

An abbreviation for the CLI type System.Byte.
val v : byte
type Color =
struct
member A : byte with get, set
member B : byte with get, set
member Clamp : unit -> unit
member ColorContext : ColorContext
member Equals : color:Color -> bool + 1 overload
member G : byte with get, set
member GetHashCode : unit -> int
member GetNativeColorValues : unit -> float32[]
member R : byte with get, set
member ScA : float32 with get, set
...
end

Full name: System.Windows.Media.Color
Color.FromRgb(r: byte, g: byte, b: byte) : Color
type Image =
inherit FrameworkElement
new : unit -> Image
member Source : ImageSource with get, set
member Stretch : Stretch with get, set
member StretchDirection : StretchDirection with get, set
event ImageFailed : EventHandler<ExceptionRoutedEventArgs>
static val SourceProperty : DependencyProperty
static val StretchProperty : DependencyProperty
static val StretchDirectionProperty : DependencyProperty
static val ImageFailedEvent : RoutedEvent

Full name: System.Windows.Controls.Image


------
Image() : unit
type HorizontalAlignment =
| Left = 0
| Center = 1
| Right = 2
| Stretch = 3

Full name: System.Windows.HorizontalAlignment
field HorizontalAlignmentLeft = 0
val sp : StackPanel
type StackPanel =
inherit Panel
new : unit -> StackPanel
member CanHorizontallyScroll : bool with get, set
member CanVerticallyScroll : bool with get, set
member ExtentHeight : float
member ExtentWidth : float
member HorizontalOffset : float
member LineDown : unit -> unit
member LineLeft : unit -> unit
member LineRight : unit -> unit
member LineUp : unit -> unit
...

Full name: System.Windows.Controls.StackPanel


------
StackPanel() : unit
val add : (UIElement -> unit)
val x : UIElement
property Panel.Children: UIElementCollection
UIElementCollection.Add(element: UIElement) : int
val ignore : value:'T -> unit

Full name: Microsoft.FSharp.Core.Operators.ignore

Ignore the passed value. This is often used to throw away results of a computation.
val label : (string -> unit)
val x : string
type TextBlock =
inherit FrameworkElement
new : unit -> TextBlock + 1 overload
member Background : Brush with get, set
member BaselineOffset : float with get, set
member BreakAfter : LineBreakCondition
member BreakBefore : LineBreakCondition
member ContentEnd : TextPointer
member ContentStart : TextPointer
member FontFamily : FontFamily with get, set
member FontSize : float with get, set
member FontStretch : FontStretch with get, set
...

Full name: System.Windows.Controls.TextBlock


------
TextBlock() : unit
TextBlock(inline: Documents.Inline) : unit
namespace System.Text
type Thickness =
struct
new : uniformLength:float -> Thickness + 1 overload
member Bottom : float with get, set
member Equals : obj:obj -> bool + 1 overload
member GetHashCode : unit -> int
member Left : float with get, set
member Right : float with get, set
member ToString : unit -> string
member Top : float with get, set
end

Full name: System.Windows.Thickness


------
Thickness()
Thickness(uniformLength: float) : unit
Thickness(left: float, top: float, right: float, bottom: float) : unit
type ScrollViewer =
inherit ContentControl
new : unit -> ScrollViewer
member CanContentScroll : bool with get, set
member ComputedHorizontalScrollBarVisibility : Visibility
member ComputedVerticalScrollBarVisibility : Visibility
member ContentHorizontalOffset : float with get, set
member ContentVerticalOffset : float with get, set
member ExtentHeight : float
member ExtentWidth : float
member HorizontalOffset : float with get, set
member HorizontalScrollBarVisibility : ScrollBarVisibility with get, set
...

Full name: System.Windows.Controls.ScrollViewer


------
ScrollViewer() : unit
type ScrollBarVisibility =
| Disabled = 0
| Auto = 1
| Hidden = 2
| Visible = 3

Full name: System.Windows.Controls.ScrollBarVisibility
field ScrollBarVisibilityVisible = 3
module SimpleUI

from Tsunami.IDE
val addControlToNewDocument : title:string * getControl:(unit -> UIElement) -> unit

Full name: Tsunami.IDE.SimpleUI.addControlToNewDocument
type UIElement =
inherit Visual
new : unit -> UIElement
member AddHandler : routedEvent:RoutedEvent * handler:Delegate -> unit + 1 overload
member AddToEventRoute : route:EventRoute * e:RoutedEventArgs -> unit
member AllowDrop : bool with get, set
member ApplyAnimationClock : dp:DependencyProperty * clock:AnimationClock -> unit + 1 overload
member AreAnyTouchesCaptured : bool
member AreAnyTouchesCapturedWithin : bool
member AreAnyTouchesDirectlyOver : bool
member AreAnyTouchesOver : bool
member Arrange : finalRect:Rect -> unit
...

Full name: System.Windows.UIElement


------
UIElement() : unit
val maxi : xs:'a [] -> int (requires comparison)

Full name: AccordDBN.Array.maxi

returns the index of the max item
val xs : 'a [] (requires comparison)
val x : 'a (requires comparison)
val maxBy : projection:('T -> 'U) -> array:'T [] -> 'T (requires comparison)

Full name: Microsoft.FSharp.Collections.Array.maxBy

Returns the greatest of all elements of the array, compared via Operators.max on the function result.

Exceptions:
System.ArgumentException
val snd : tuple:('T1 * 'T2) -> 'T2

Full name: Microsoft.FSharp.Core.Operators.snd

Return the second element of a tuple, snd (a,b) = b.
val fst : tuple:('T1 * 'T2) -> 'T1

Full name: Microsoft.FSharp.Core.Operators.fst

Return the first element of a tuple, fst (a,b) = a.
val predicted : int []

Full name: AccordDBN.predicted
val xs : float []
DeepBeliefNetwork.Compute(input: float []) : float []
DeepBeliefNetwork.Compute(input: float [], layerIndex: int) : float []

Computes the network's outputs for a given input.
val confustionMatrix : GeneralConfusionMatrix

Full name: AccordDBN.confustionMatrix
type GeneralConfusionMatrix =
new : matrix:int[,] -> GeneralConfusionMatrix + 2 overloads
member ChanceAgreement : float
member ChiSquare : float
member Classes : int
member ColumnProportions : float[]
member ColumnTotals : int[]
member Cramer : float
member Diagonal : int[]
member GeometricAgreement : float
member Kappa : float
...

Full name: Accord.Statistics.Analysis.GeneralConfusionMatrix

General confusion matrix for multi-class decision problems.
------
GeneralConfusionMatrix(matrix: int [,]) : unit
GeneralConfusionMatrix(matrix: float [,], samples: int) : unit
GeneralConfusionMatrix(classes: int, expected: int [], predicted: int []) : unit

Creates a new Confusion Matrix.
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn

Print to stdout using the given format, and add a newline.
property GeneralConfusionMatrix.OverallAgreement: float

Overall agreement.
val interactiveControl : unit -> Grid

Full name: AccordDBN.interactiveControl
val inkCanvas : InkCanvas
type InkCanvas =
inherit FrameworkElement
new : unit -> InkCanvas
member ActiveEditingMode : InkCanvasEditingMode
member Background : Brush with get, set
member CanPaste : unit -> bool
member Children : UIElementCollection
member CopySelection : unit -> unit
member CutSelection : unit -> unit
member DefaultDrawingAttributes : DrawingAttributes with get, set
member DefaultStylusPointDescription : StylusPointDescription with get, set
member EditingMode : InkCanvasEditingMode with get, set
...

Full name: System.Windows.Controls.InkCanvas


------
InkCanvas() : unit
type InkCanvasEditingMode =
| None = 0
| Ink = 1
| GestureOnly = 2
| InkAndGesture = 3
| Select = 4
| EraseByPoint = 5
| EraseByStroke = 6

Full name: System.Windows.Controls.InkCanvasEditingMode
field InkCanvasEditingModeInk = 1
type Background =
| EmptyColor
| Gradient of Color * Color * GradientStyle
| Solid of Color

Full name: Tsunami.IDE.FSharp.Charting.Background
type Brushes =
static member AliceBlue : SolidColorBrush
static member AntiqueWhite : SolidColorBrush
static member Aqua : SolidColorBrush
static member Aquamarine : SolidColorBrush
static member Azure : SolidColorBrush
static member Beige : SolidColorBrush
static member Bisque : SolidColorBrush
static member Black : SolidColorBrush
static member BlanchedAlmond : SolidColorBrush
static member Blue : SolidColorBrush
...

Full name: System.Windows.Media.Brushes
property Brushes.White: SolidColorBrush
type VerticalAlignment =
| Top = 0
| Center = 1
| Bottom = 2
| Stretch = 3

Full name: System.Windows.VerticalAlignment
field VerticalAlignmentTop = 0
type DrawingAttributes =
new : unit -> DrawingAttributes
member AddPropertyData : propertyDataId:Guid * propertyData:obj -> unit
member Clone : unit -> DrawingAttributes
member Color : Color with get, set
member ContainsPropertyData : propertyDataId:Guid -> bool
member Equals : o:obj -> bool
member FitToCurve : bool with get, set
member GetHashCode : unit -> int
member GetPropertyData : propertyDataId:Guid -> obj
member GetPropertyDataIds : unit -> Guid[]
...

Full name: System.Windows.Ink.DrawingAttributes


------
DrawingAttributes() : unit
type Colors =
static member AliceBlue : Color
static member AntiqueWhite : Color
static member Aqua : Color
static member Aquamarine : Color
static member Azure : Color
static member Beige : Color
static member Bisque : Color
static member Black : Color
static member BlanchedAlmond : Color
static member Blue : Color
...

Full name: System.Windows.Media.Colors
property Colors.Black: Color
type StylusTip =
| Rectangle = 0
| Ellipse = 1

Full name: System.Windows.Ink.StylusTip
field StylusTipEllipse = 1
val ic : Canvas
type Canvas =
inherit Panel
new : unit -> Canvas
static val LeftProperty : DependencyProperty
static val TopProperty : DependencyProperty
static val RightProperty : DependencyProperty
static val BottomProperty : DependencyProperty
static member GetBottom : element:UIElement -> float
static member GetLeft : element:UIElement -> float
static member GetRight : element:UIElement -> float
static member GetTop : element:UIElement -> float
static member SetBottom : element:UIElement * length:float -> unit
...

Full name: System.Windows.Controls.Canvas


------
Canvas() : unit
val inkBmp : WriteableBitmap
val inkImg : Image
val outBmp : WriteableBitmap
val outImg : Border
type Border =
inherit Decorator
new : unit -> Border
member Background : Brush with get, set
member BorderBrush : Brush with get, set
member BorderThickness : Thickness with get, set
member CornerRadius : CornerRadius with get, set
member Padding : Thickness with get, set
static val BorderThicknessProperty : DependencyProperty
static val PaddingProperty : DependencyProperty
static val CornerRadiusProperty : DependencyProperty
static val BorderBrushProperty : DependencyProperty
...

Full name: System.Windows.Controls.Border


------
Border() : unit
property Brushes.LightBlue: SolidColorBrush
val clear : Button
type Button =
inherit ButtonBase
new : unit -> Button
member IsCancel : bool with get, set
member IsDefault : bool with get, set
member IsDefaulted : bool
static val IsDefaultProperty : DependencyProperty
static val IsCancelProperty : DependencyProperty
static val IsDefaultedProperty : DependencyProperty

Full name: System.Windows.Controls.Button


------
Button() : unit
val predictedOutput : TextBlock
val loadRandom : Button
val randomInput : TextBlock
val rnd : Random
type Random =
new : unit -> Random + 1 overload
member Next : unit -> int + 2 overloads
member NextBytes : buffer:byte[] -> unit
member NextDouble : unit -> float

Full name: System.Random

Represents a pseudo-random number generator, a device that produces a sequence of numbers that meet certain statistical requirements for randomness.
------
Random() : unit
Random(Seed: int) : unit

Initializes a new instance of the System.Random class, using a time-dependent default seed value.
val predOut : Shapes.Rectangle []
namespace System.Windows.Shapes
type Rectangle =
inherit Shape
new : unit -> Rectangle
member GeometryTransform : Transform
member RadiusX : float with get, set
member RadiusY : float with get, set
member RenderedGeometry : Geometry
static val RadiusXProperty : DependencyProperty
static val RadiusYProperty : DependencyProperty

Full name: System.Windows.Shapes.Rectangle


------
Shapes.Rectangle() : unit
property Brushes.Blue: SolidColorBrush
field VerticalAlignmentBottom = 2
val predGrid : Primitives.UniformGrid
namespace System.Windows.Controls.Primitives
type UniformGrid =
inherit Panel
new : unit -> UniformGrid
member Columns : int with get, set
member FirstColumn : int with get, set
member Rows : int with get, set
static val FirstColumnProperty : DependencyProperty
static val ColumnsProperty : DependencyProperty
static val RowsProperty : DependencyProperty

Full name: System.Windows.Controls.Primitives.UniformGrid


------
Primitives.UniformGrid() : unit
val iter : action:('T -> unit) -> array:'T [] -> unit

Full name: Microsoft.FSharp.Collections.Array.iter

Applies the given function to each element of the array.
field HorizontalAlignmentCenter = 1
val updateSparkline : (float [] -> unit)
val max : int
val iter2 : action:('T1 -> 'T2 -> unit) -> array1:'T1 [] -> array2:'T2 [] -> unit

Full name: Microsoft.FSharp.Collections.Array.iter2

Applies the given function to pair of elements drawn from matching indices in two arrays. The two arrays must have the same lengths, otherwise an ArgumentException is raised.

Exceptions:
System.ArgumentException
val pred : Shapes.Rectangle
property FrameworkElement.Height: float
property Shapes.Shape.Fill: Brush
property Brushes.Green: SolidColorBrush
event Primitives.ButtonBase.Click: IEvent<RoutedEventHandler,RoutedEventArgs>
member IObservable.Add : callback:('T -> unit) -> unit
Random.Next() : int
Random.Next(maxValue: int) : int
Random.Next(minValue: int, maxValue: int) : int

Returns a nonnegative random number.
property InkCanvas.Strokes: StrokeCollection
Collections.ObjectModel.Collection.Clear() : unit

Removes all elements from the System.Collections.ObjectModel.Collection`1.
val is : float []
val actual : int
property TextBlock.Text: string
val sprintf : format:Printf.StringFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.sprintf

Print to a string using the given format.
property Colors.White: Color
val os : float []
val rs : float []
val predicted : int
property Border.BorderBrush: Brush
property Brushes.Red: SolidColorBrush
val recalc : (unit -> unit)
property UIElement.Opacity: float
UIElement.Measure(availableSize: Size) : unit
type Size =
struct
new : width:float * height:float -> Size
member Equals : o:obj -> bool + 1 overload
member GetHashCode : unit -> int
member Height : float with get, set
member IsEmpty : bool
member ToString : unit -> string + 1 overload
member Width : float with get, set
static member Empty : Size
static member Equals : size1:Size * size2:Size -> bool
static member Parse : source:string -> Size
end

Full name: System.Windows.Size


------
Size()
Size(width: float, height: float) : unit
UIElement.Arrange(finalRect: Rect) : unit
type Rect =
struct
new : size:Size -> Rect + 4 overloads
member Bottom : float
member BottomLeft : Point
member BottomRight : Point
member Contains : point:Point -> bool + 2 overloads
member Equals : o:obj -> bool + 1 overload
member GetHashCode : unit -> int
member Height : float with get, set
member Inflate : size:Size -> unit + 1 overload
member Intersect : rect:Rect -> unit
...
end

Full name: System.Windows.Rect


------
Rect()
Rect(size: Size) : unit
Rect(location: Point, size: Size) : unit
Rect(point1: Point, point2: Point) : unit
Rect(point: Point, vector: Vector) : unit
Rect(x: float, y: float, width: float, height: float) : unit
val rtb : RenderTargetBitmap
type RenderTargetBitmap =
inherit BitmapSource
new : pixelWidth:int * pixelHeight:int * dpiX:float * dpiY:float * pixelFormat:PixelFormat -> RenderTargetBitmap
member Clear : unit -> unit
member Render : visual:Visual -> unit

Full name: System.Windows.Media.Imaging.RenderTargetBitmap


------
RenderTargetBitmap(pixelWidth: int, pixelHeight: int, dpiX: float, dpiY: float, pixelFormat: PixelFormat) : unit
property PixelFormats.Default: PixelFormat
RenderTargetBitmap.Render(visual: Visual) : unit
type Point =
struct
new : x:float * y:float -> Point
member Equals : o:obj -> bool + 1 overload
member GetHashCode : unit -> int
member Offset : offsetX:float * offsetY:float -> unit
member ToString : unit -> string + 1 overload
member X : float with get, set
member Y : float with get, set
static member Add : point:Point * vector:Vector -> Point
static member Equals : point1:Point * point2:Point -> bool
static member Multiply : point:Point * matrix:Matrix -> Point
...
end

Full name: System.Windows.Point


------
Point()
Point(x: float, y: float) : unit
val wb : WriteableBitmap
val input : float []
WriteableBitmap.GetPixel(x: int, y: int) : Color

Gets the color of the pixel at the x, y coordinate as a Color struct. For best performance this method should not be used in iterative real-time scenarios. Implement the code directly inside a loop.
property Color.R: byte
event UIElement.PreviewMouseDown: IEvent<Input.MouseButtonEventHandler,Input.MouseButtonEventArgs>
event UIElement.MouseUp: IEvent<Input.MouseButtonEventHandler,Input.MouseButtonEventArgs>
event InkCanvas.StrokeCollected: IEvent<InkCanvasStrokeCollectedEventHandler,InkCanvasStrokeCollectedEventArgs>
WriteableBitmap.Clear() : unit
WriteableBitmap.Clear(color: Color) : unit

Fills the whole WriteableBitmap with an empty color (0).
val mainGrid : Grid
type Grid =
inherit Panel
new : unit -> Grid
member ColumnDefinitions : ColumnDefinitionCollection
member RowDefinitions : RowDefinitionCollection
member ShouldSerializeColumnDefinitions : unit -> bool
member ShouldSerializeRowDefinitions : unit -> bool
member ShowGridLines : bool with get, set
static val ShowGridLinesProperty : DependencyProperty
static val ColumnProperty : DependencyProperty
static val RowProperty : DependencyProperty
static val ColumnSpanProperty : DependencyProperty
...

Full name: System.Windows.Controls.Grid


------
Grid() : unit
property Grid.ColumnDefinitions: ColumnDefinitionCollection
ColumnDefinitionCollection.Add(value: ColumnDefinition) : unit
type ColumnDefinition =
inherit DefinitionBase
new : unit -> ColumnDefinition
member ActualWidth : float
member MaxWidth : float with get, set
member MinWidth : float with get, set
member Offset : float
member Width : GridLength with get, set
static val WidthProperty : DependencyProperty
static val MinWidthProperty : DependencyProperty
static val MaxWidthProperty : DependencyProperty

Full name: System.Windows.Controls.ColumnDefinition


------
ColumnDefinition() : unit
property Grid.RowDefinitions: RowDefinitionCollection
RowDefinitionCollection.Add(value: RowDefinition) : unit
type RowDefinition =
inherit DefinitionBase
new : unit -> RowDefinition
member ActualHeight : float
member Height : GridLength with get, set
member MaxHeight : float with get, set
member MinHeight : float with get, set
member Offset : float
static val HeightProperty : DependencyProperty
static val MinHeightProperty : DependencyProperty
static val MaxHeightProperty : DependencyProperty

Full name: System.Windows.Controls.RowDefinition


------
RowDefinition() : unit
type GridLength =
struct
new : pixels:float -> GridLength + 1 overload
member Equals : oCompare:obj -> bool + 1 overload
member GetHashCode : unit -> int
member GridUnitType : GridUnitType
member IsAbsolute : bool
member IsAuto : bool
member IsStar : bool
member ToString : unit -> string
member Value : float
static member Auto : GridLength
end

Full name: System.Windows.GridLength


------
GridLength()
GridLength(pixels: float) : unit
GridLength(value: float, type: GridUnitType) : unit
val iter : action:('T -> unit) -> source:seq<'T> -> unit

Full name: Microsoft.FSharp.Collections.Seq.iter

Applies the given function to each element of the collection.

Exceptions:
System.ArgumentNullException
val sp2 : StackPanel
type Orientation =
| Horizontal = 0
| Vertical = 1

Full name: System.Windows.Controls.Orientation
field OrientationHorizontal = 0
Grid.SetRow(element: UIElement, value: int) : unit
Grid.SetColumn(element: UIElement, value: int) : unit