Skip to content

Instantly share code, notes, and snippets.

@catlion
catlion / NugetProxy.cs
Created February 26, 2019 12:48
Simple proxy service for Nuget.org
using Microsoft.AspNetCore.Http;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace VTB.Portal.NugetProxy
{
@catlion
catlion / ConstrainedTypesExamples.fsx
Created December 1, 2017 08:50 — forked from swlaschin/ConstrainedTypesExamples.fsx
Examples of creating constrained types in F#
module ConstrainedTypes =
open System
// General hints on defining types with constraints or invariants
//
// Just as in C#, use a private constructor
// and expose "factory" methods that enforce the constraints
//
// In F#, only classes can have private constructors with public members.
//
module BadukBot.Api
open BadukBot.Telegram
open System
open System.Net.Http
let private client =
let h = new HttpClientHandler()
h.AllowAutoRedirect <- true
h.MaxRequestContentBufferSize <- 1024L * 1024L
@catlion
catlion / Build.fsx
Last active January 28, 2016 21:48
Build.fsx target fragment
#r "c:/dev/git/ContractLookup/tools/FAKE/tools/FakeLib.dll"
#r "System.Configuration.dll"
open Fake
open Fake.AssemblyInfoFile
open Fake.ReleaseNotesHelper
open Fake.ProcessHelper
open System
open System.Configuration
open System.IO
@catlion
catlion / gist:b24686474d1692239afb
Created January 28, 2016 20:47 — forked from anonymous/gist:e04333e0aa5173a3b090
Build Target and Web.config file transformations
Target "Build" (fun _ ->
!! "ContractLookup.sln"
|> MSBuild buildDir "Build" [
"Optimize", "True"
"DebugSymbols", "True"
"Configuration", "Debug"
"Platform", "Any CPU"
]
|> Log "Build-Output: "

A Few Useful Things to Know about Machine Learning

The paper presents some key lessons and "folk wisdom" that machine learning researchers and practitioners have learnt from experience and which are hard to find in textbooks.

1. Learning = Representation + Evaluation + Optimization

All machine learning algorithms have three components:

  • Representation for a learner is the set if classifiers/functions that can be possibly learnt. This set is called hypothesis space. If a function is not in hypothesis space, it can not be learnt.
  • Evaluation function tells how good the machine learning model is.
  • Optimisation is the method to search for the most optimal learning model.
@catlion
catlion / F# build
Created June 26, 2013 17:35
F# build failed on mono
make -C src/fsharp all
make[1]: Entering directory `/home/artem/dev/mono3/fsharp/src/fsharp'
make do-proto
make[2]: Entering directory `/home/artem/dev/mono3/fsharp/src/fsharp'
make -C FSharp.Build-proto do-proto
make[3]: Entering directory `/home/artem/dev/mono3/fsharp/src/fsharp/FSharp.Build-proto'
mkdir -p .libs/proto
mkdir -p .libs/proto//2.0
mkdir -p .libs/proto//4.0
mono --gc=sgen /home/artem/dev/mono3/fsharp/lib/bootstrap/4.0/../2.0/fssrgen.exe ../FSharp.Build/FSBuild.txt .libs/proto/FSBuild.fs .libs/proto/FSBuild.resx
declare @max_mrdate datetime
declare @max_nexteval datetime
select
@max_mrdate=max(cast(mrdate as datetime)),
@max_nexteval=max(cast(nexteval as datetime))
from tblpms
where CaseNo = 'TR13-011-CRW'
select *
@catlion
catlion / gist:3011514
Created June 28, 2012 13:52
Subgraphs
-- Get all friends of the given one
group :: [(Int,Int)] -> [Int] -> Int -> [Int]
group [] acc x = acc
group l [] x = group l [x] x
group ((x1, x2):tl) acc x =
case xx of (True, False) -> (group tl (x2 : (group tl (x2 : acc) x)) x2)
(False, True) -> group tl (x1 : (group tl (x1 : acc) x)) x1
otherwise -> group tl acc x
where xx = (isin x1 x2, isin x2 x1)
isin d p = not (p `elem` acc) && (d == x || d `elem` acc)
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PsortTest
{
class Program
{