0
0

Add ModelBuilder
All checks were successful
Test ML model / build (push) Successful in 1m8s

This commit is contained in:
Serghei Cebotari 2024-01-11 17:48:01 +03:00
parent 8e17c5b2da
commit 9c87e6d4da
2 changed files with 11 additions and 4 deletions

View File

@ -0,0 +1,10 @@
using RhSolutions.ML.Lib;
namespace RhSolutions.ML.Tests;
[SetUpFixture]
public class ModelBuilder
{
[OneTimeSetUp]
public void Build() => RhSolutionsMLBuilder.RebuildModel();
}

View File

@ -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));
} }
} }