Skip to content
Permalink
Browse files

Remove unused regularization parameters. Will put them back when actu…

…ally used in computation
  • Loading branch information...
cbovar committed Feb 10, 2019
1 parent 7f58b36 commit 8a1252d66c1ee67d1a4e30b8c7f4c0ec91840067
@@ -52,7 +52,7 @@ private static void Classify2DDemo()
labels.Add(1);
var n = labels.Count;

var trainer = new SgdTrainer<double>(net) { LearningRate = 0.01, L2Decay = 0.001, BatchSize = n };
var trainer = new SgdTrainer<double>(net) { LearningRate = 0.01, BatchSize = n };

// Training
do
@@ -45,7 +45,6 @@ private void MnistDemo()
{
LearningRate = 0.01,
BatchSize = 20,
L2Decay = 0.001,
Momentum = 0.9
};

@@ -39,7 +39,7 @@ private static void Main()
// prob is a Volume. Volumes have a property Weights that stores the raw data, and WeightGradients that stores gradients
Console.WriteLine("probability that x is class 0: " + prob.Get(0)); // prints e.g. 0.50101

var trainer = new SgdTrainer(net) { LearningRate = 0.01, L2Decay = 0.001 };
var trainer = new SgdTrainer(net) { LearningRate = 0.01 };
trainer.Train(x, BuilderInstance.Volume.From(new[] { 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, new Shape(1, 1, 10, 1))); // train the network, specifying that x is class zero

var prob2 = net.Forward(x);
@@ -45,7 +45,6 @@ private void MnistDemo()
{
LearningRate = 0.01,
BatchSize = 20,
L2Decay = 0.001,
Momentum = 0.9
};

@@ -13,9 +13,6 @@ public class ConvLayer<T> : LayerBase<T>, IDotProductLayer<T> where T : struct,

public ConvLayer(Dictionary<string, object> data) : base(data)
{
this.L1DecayMul = Ops<T>.Zero;
this.L2DecayMul = Ops<T>.One;

this.FilterCount = Convert.ToInt32(data["FilterCount"]);
this.Width = Convert.ToInt32(data["Width"]);
this.Height = Convert.ToInt32(data["Height"]);
@@ -32,9 +29,6 @@ public ConvLayer(Dictionary<string, object> data) : base(data)

public ConvLayer(int width, int height, int filterCount)
{
this.L1DecayMul = Ops<T>.Zero;
this.L2DecayMul = Ops<T>.One;

this.FilterCount = filterCount;
this.Width = width;
this.Height = height;
@@ -54,10 +48,6 @@ public ConvLayer(int width, int height, int filterCount)

public int FilterCount { get; }

public T L1DecayMul { get; set; }

public T L2DecayMul { get; set; }

public int Stride
{
get { return this._stride; }
@@ -18,10 +18,6 @@ public SgdTrainer(INet<T> net) : base(net)
{
}

public T L1Decay { get; set; }

public T L2Decay { get; set; }

public T Momentum { get; set; }

public T LearningRate { get; set; }
@@ -117,8 +117,6 @@ private static TestNet Create(int layerSize, int nmLayers, Shape input, int outp
var trainer = new SgdTrainer(net);
trainer.LearningRate = 0.01;
trainer.Momentum = 0.5;
trainer.L1Decay = 0.01;
trainer.L2Decay = 0.01;
trainer.BatchSize = batchSize;

for (var i = 0; i < iterations; i++)

0 comments on commit 8a1252d

Please sign in to comment.
You can’t perform that action at this time.