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
# Splitting large CSV files into smaller ones, preserving the headers | |
# By Joannes Vermorel, 2015-12-18 | |
function Split-Csv | |
{ | |
param | |
( | |
[string] $file, | |
[int] $maxLines | |
) |
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
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
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
# 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
<# | |
Iterate through all subdirectories, and perform Git fetch, then Git rebase | |
on each subdirectory. | |
Joannes Vermorel, 2012-04-25 | |
#> | |
$initpath = get-location | |
foreach($path in get-childitem) { | |
if ($path.Attributes -eq "Directory") { |
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
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
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
/// ================ 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 | |
{ |