This commit is contained in:
parent
8e17c5b2da
commit
9c87e6d4da
10
RhSolutions.ML.Tests/ModelBuilder.cs
Normal file
10
RhSolutions.ML.Tests/ModelBuilder.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using RhSolutions.ML.Lib;
|
||||||
|
|
||||||
|
namespace RhSolutions.ML.Tests;
|
||||||
|
|
||||||
|
[SetUpFixture]
|
||||||
|
public class ModelBuilder
|
||||||
|
{
|
||||||
|
[OneTimeSetUp]
|
||||||
|
public void Build() => RhSolutionsMLBuilder.RebuildModel();
|
||||||
|
}
|
@ -1,5 +1,3 @@
|
|||||||
using RhSolutions.ML.Lib;
|
|
||||||
|
|
||||||
namespace RhSolutions.ML.Tests;
|
namespace RhSolutions.ML.Tests;
|
||||||
|
|
||||||
public abstract class TestBase
|
public abstract class TestBase
|
||||||
@ -11,7 +9,6 @@ public abstract class TestBase
|
|||||||
|
|
||||||
public TestBase()
|
public TestBase()
|
||||||
{
|
{
|
||||||
RhSolutionsMLBuilder.RebuildModel();
|
|
||||||
_mlContext = new MLContext(seed: 0);
|
_mlContext = new MLContext(seed: 0);
|
||||||
ITransformer loadedNodel = _mlContext.Model.Load(_dataPath, out var _);
|
ITransformer loadedNodel = _mlContext.Model.Load(_dataPath, out var _);
|
||||||
_predEngine = _mlContext.Model.CreatePredictionEngine<Product, TypePrediction>(loadedNodel);
|
_predEngine = _mlContext.Model.CreatePredictionEngine<Product, TypePrediction>(loadedNodel);
|
||||||
@ -36,4 +33,4 @@ public abstract class TestBase
|
|||||||
var prediction = _predEngine.Predict(actual);
|
var prediction = _predEngine.Predict(actual);
|
||||||
Assert.That(prediction.Type, Is.EqualTo(expected.Type));
|
Assert.That(prediction.Type, Is.EqualTo(expected.Type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user