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
using System.Reflection; | |
using System.Reflection.Emit; | |
public static class DelegateHelper | |
{ | |
/// <summary> | |
/// Compile the 'Delegate' to a static method. | |
/// </summary> | |
public static MethodInfo CompileToMethod(Delegate del) | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using Xunit; | |
namespace MyMurmurHash | |
{ | |
/// <summary> | |
/// Fast hash - non-crypto secure. Intended to detect data storage | |
/// corruption. | |
/// </summary> |
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
// Fast 1D convolution with AXV | |
// By Joannes Vermorel, Lokad, January 2018 | |
// Released under MIT license | |
#include <string.h> | |
#include <stdio.h> | |
#include <malloc.h> | |
/* A simple implementation of a 1D convolution that just iterates over | |
* scalar values of the input array. |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using NUnit.Framework; | |
namespace Lokad | |
{ | |
/// <summary> |
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using NUnit.Framework; | |
namespace Lokad | |
{ | |
/// <summary> | |
/// A random forest tailored for regression, treading categorical variables as on ordinals. |
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
# A constant 1D tensor that contains an enumeration 0 .. (count - 1). | |
Range(count) = Splice( array [0..(count-1)] ( i => Constant{i} ) ) | |
# residual units | |
ResNet(InnerDim, OuterDim, INNODE) = { | |
L1 = DenseLayer {InnerDim, activation = ReLU, init = "gaussian"}( INNODE ) | |
L2 = DenseLayer {OuterDim, activation = Pass, init = "gaussian"}( L1 ) | |
ResUnit = ReLU(Plus(INNODE, L2)) | |
}.ResUnit |
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
namespace Lokad | |
{ | |
/// <summary> | |
/// Z-Transform is the discrete version of the Laplace transform. | |
/// In their transformed form, the convolution of two distributions | |
/// is just the point-wise product of their Z-transform coefficients. |
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
/// ================ Half.cs ==================== | |
/// The code is free to use for any reason without any restrictions. | |
/// Ladislav Lang (2009), Joannes Vermorel (2017) | |
using System; | |
using System.Diagnostics; | |
using System.Globalization; | |
namespace SystemHalf | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Lokad | |
{ | |
/// <summary> | |
/// Naive Bayesian classifier. | |
/// </summary> | |
/// <remarks> |
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
# Random expansion of monthly data into daily data | |
# Syntax: convert-daily "c:\LokadData\foo.tsv" | |
# Expected columns are Id, Date, Quantity | |
# By Joannes Vermorel, April 2016 | |
function convert-daily | |
{ | |
param | |
( | |
[string] $file |
NewerOlder