This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System.IO | |
open System.Net | |
let wc = new WebClient() | |
let trainingSetFile = Path.Combine( __SOURCE_DIRECTORY__, "trainingSet.csv") | |
File.WriteAllText(trainingSetFile, | |
contents = wc.DownloadString("http://brandewinder.blob.core.windows.net/public/trainingsample.csv") | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TYPES | |
//In the card game poker... | |
type Card = Face * Suit | |
and Suit = Spades | Diamonds | Clubs | Hearts | |
//The cards are valued in the order: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "bin/Debug/SqlCommandTypeProvider.dll" | |
open FSharp.NYC.Tutorial | |
[<Literal>] | |
let connectionString="Data Source=.\SQLExpress;Initial Catalog=AdventureWorks2012;Integrated Security=True" | |
type QueryPersonInfo = SqlCommand<"SELECT * FROM dbo.ufnGetContactInformation(@PersonId)", connectionString> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Parse = | |
let inline tryParse<'T when ^T : (static member TryParse: string * ^T byref -> bool)> s = | |
let mutable x = Unchecked.defaultof<_> | |
if (^T: (static member TryParse: string * ^T byref -> bool) (s, &x)) then Some x else None | |
let (|Int|_|) = tryParse<int> | |
let (|Int64|_|) = tryParse<int64> | |
let (|Decimal|_|) = tryParse<decimal> | |
let (|DateTime|_|) = tryParse<DateTime> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Test | |
type MyType = | |
static member AsyncWithRefParams(i : int byref) = | |
async { | |
i <- 5 | |
} | |
module Program = | |
[<EntryPoint>] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.Net | |
open Microsoft.FSharp.Control.WebExtensions | |
open System.Windows.Forms | |
open System.Threading | |
let form = new Form() | |
let text = new Label() | |
let button = new Button() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
let getComparableUri uri = { | |
new Uri( uri) | |
interface IComparable<string> with | |
member this.CompareTo other = | |
compare (string this) other | |
} | |
let url = "http://news.google.com/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Symbology | |
open System | |
let yahoo symbol = | |
use wc = new Net.WebClient() | |
let yahoo = "http://download.finance.yahoo.com/d" | |
let uri = sprintf "%s/quotes.csv?s&f=nl1" yahoo symbol | |
wc.DownloadString(uri) | |
.Split([| "\n\r" |], StringSplitOptions.RemoveEmptyEntries) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open FSharp.Data | |
type Get42 = SqlCommandProvider<"SELECT 42", "Data Source=.;Integrated Security=True;", SingleRow = true> | |
Get42.Create().Execute() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
let sigmoid z = 1.0 / (1.0 + exp (- z)) | |
let logistic (weights:float[]) (features:float[]) = | |
let sumProd = (weights, features) ||> Array.map2 (*) |> Array.sum | |
sigmoid sumProd | |
let makeAllData (numFeatures, numRows, seed) = |
OlderNewer