public void InitializeTheta() { var engine = new NeuralNetworkEngine(_config400x25x10); var theta = engine.InitializeTheta(); theta.Count.Should().Be(25 * 401 + 10 * 26); theta.All(i => i > 0 && i < 1); }
public void ReshapeTheta() { var engine = new NeuralNetworkEngine(_config1x2X2x1); var vector = new double[] { 11, 12, 21, 22, 11, 12, 13, 11, 12, 21, 22, 31, 32 }; var matrices = engine.ReshapeTheta(vector.ToArray(), new int[] { 1, 2, 1, 3 }); var reshaped = engine.ReshapeTheta(matrices); reshaped.Should().BeEquivalentTo(vector.ToArray()); var theta = engine.InitializeTheta(); var Theta = engine.ReshapeTheta(theta.ToArray(), _config1x2X2x1.Layers); Theta.Length.Should().Be(3); Theta[0].RowCount.Should().Be(2); Theta[0].ColumnCount.Should().Be(2); Theta[1].RowCount.Should().Be(2); Theta[1].ColumnCount.Should().Be(3); Theta[2].RowCount.Should().Be(1); Theta[2].ColumnCount.Should().Be(3); var thetaVector = engine.ReshapeTheta(Theta); thetaVector.Should().BeEquivalentTo(theta.ToArray()); }