This file contains hidden or 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 | |
open System.Windows.Forms | |
open System.Drawing | |
//The type that represents each row of the training | |
//or the test dataset | |
type Entry = {Label :string; Values : int list} | |
//Calculates Squared Euclidean distance between pixel |
This file contains hidden or 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
//Finds the median | |
let median numbers = | |
let sorted = List.sort numbers | |
let n = float numbers.Length | |
let x = int (n/2.) | |
let mutable result = 0.0 | |
if (float numbers.Length) % 2. = 0.0 then result <- float (numbers.[x] + | |
numbers.[x-1]) / 2.0 | |
else result <- float numbers.[x] | |
result |
This file contains hidden or 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.Text.RegularExpressions | |
type SentiWordNetEntry = {POS:string; ID:string; PositiveScore:string; NegativeScore:string; Words:string} | |
let sentiWordList = System.IO.File.ReadAllLines(@"SentiWordNet_3.0.0_20130122.txt") | |
|> Array.filter (fun line -> not (line.StartsWith("#"))) | |
|> Array.map (fun line -> line.Split '\t') | |
|> Array.map (fun lineTokens -> {POS = lineTokens.[0]; | |
ID = lineTokens.[1]; | |
PositiveScore = lineTokens.[2].Trim(); |
This file contains hidden or 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
#load "...\packages\MathNet.Numerics.FSharp.3.10.0\MathNet.Numerics.fsx" | |
open MathNet.Numerics.LinearAlgebra | |
open System.IO | |
let velocities = vector[23.;4.;5.;2.] | |
//let y = matrix [[1.;3.] | |
// [1.;5.] | |
// [1.;4.]] |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Net.Sockets; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ |
This file contains hidden or 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
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | |
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Threading; | |
using Microsoft.CodeAnalysis.CSharp.Symbols; | |
using Microsoft.CodeAnalysis.Text; | |
using Roslyn.Utilities; |
This file contains hidden or 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
/// <summary> | |
/// Sample singleton object. | |
/// </summary> | |
public sealed class SiteStructure | |
{ | |
/// <summary> | |
/// This is an expensive resource. | |
/// We need to only store it in one place. | |
/// </summary> | |
object[] _data = new object[10]; |
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
namespace DoFactory.GangOfFour.Singleton.NETOptimized | |
{ | |
class MainApp | |
{ | |
static void Main() | |
{ | |
} |
This file contains hidden or 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
public sealed class APILookup | |
{ | |
private static readonly APILookup _instance = new APILookup(); | |
private Dictionary<string, int> _lookup; | |
private APILookup() | |
{ | |
try | |
{ | |
_lookup = Utility.GetLookup(); |
This file contains hidden or 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
using System; | |
namespace DoFactory.GangOfFour.Facade.RealWorld | |
{ | |
/// <summary> | |
/// MainApp startup class for Real-World | |
/// Facade Design Pattern. | |
/// </summary> | |
class MainApp | |
{ | |
/// <summary> |