Skip to content

Commit

Permalink
Merge pull request #137 from cbovar/Remove_Unused_Regularization
Browse files Browse the repository at this point in the history
Remove unused regularization parameters.
  • Loading branch information
cbovar authored Feb 10, 2019
2 parents 7f58b36 + 8a1252d commit 74716a6
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Examples/Classify2DDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Examples/FluentMnistDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ private void MnistDemo()
{
LearningRate = 0.01,
BatchSize = 20,
L2Decay = 0.001,
Momentum = 0.9
};

Expand Down
2 changes: 1 addition & 1 deletion Examples/MinimalExample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion Examples/MnistDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ private void MnistDemo()
{
LearningRate = 0.01,
BatchSize = 20,
L2Decay = 0.001,
Momentum = 0.9
};

Expand Down
10 changes: 0 additions & 10 deletions src/ConvNetSharp.Core/Layers/ConvLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand All @@ -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;
Expand All @@ -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; }
Expand Down
4 changes: 0 additions & 4 deletions src/ConvNetSharp.Core/Training/SgdTrainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 0 additions & 2 deletions src/ConvNetSharp.Performance.Tests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ private static void ExecuteNeuralNet(
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++)
Expand Down

0 comments on commit 74716a6

Please sign in to comment.