Browse Source

tests: added neural net XOR tests and enabled KMeans test which passes

tags/v0.9
Meinrad Recheis 6 years ago
parent
commit
e4936478bc
2 changed files with 11 additions and 7 deletions
  1. +2
    -2
      test/TensorFlowNET.Examples/NeuralNetXor.cs
  2. +9
    -5
      test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs

+ 2
- 2
test/TensorFlowNET.Examples/NeuralNetXor.cs View File

@@ -16,7 +16,7 @@ namespace TensorFlowNET.Examples
public int Priority => 10;
public bool Enabled { get; set; } = true;
public string Name => "NN XOR";
public bool ImportGraph { get; set; } = false;
public bool ImportGraph { get; set; } = true;
public int num_steps = 5000;
@@ -57,7 +57,7 @@ namespace TensorFlowNET.Examples
else
loss_value=RunWithBuiltGraph();
return loss_value < 0.0627;
return loss_value < 0.0628;
}
private float RunWithImportedGraph()


+ 9
- 5
test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs View File

@@ -40,12 +40,11 @@ namespace TensorFlowNET.ExamplesTests
new InceptionArchGoogLeNet() { Enabled = true }.Run();
}
[Ignore]
[TestMethod]
public void KMeansClustering()
{
tf.Graph().as_default();
new KMeansClustering() { Enabled = true, train_size = 500, validation_size = 100, test_size = 100, batch_size =100 }.Run();
new KMeansClustering() { Enabled = true, ImportGraph = true, train_size = 500, validation_size = 100, test_size = 100, batch_size =100 }.Run();
}
[TestMethod]
@@ -109,15 +108,20 @@ namespace TensorFlowNET.ExamplesTests
new TextClassificationWithMovieReviews() { Enabled = true }.Run();
}
[Ignore("Loss function optimization is not working yet")]
[TestMethod]
public void NeuralNetXor()
{
tf.Graph().as_default();
Assert.IsTrue(new NeuralNetXor() { Enabled = true }.Run());
Assert.IsTrue(new NeuralNetXor() { Enabled = true, ImportGraph = false }.Run());
}
[TestMethod]
public void NeuralNetXor_ImportedGraph()
{
tf.Graph().as_default();
Assert.IsTrue(new NeuralNetXor() { Enabled = true, ImportGraph = true }.Run());
}
}
}

Loading…
Cancel
Save