Remove RhSolutions.Console
This commit is contained in:
parent
a3cc89ce04
commit
3be0df94c0
@ -1,11 +0,0 @@
|
|||||||
using RhSolutions.ML.Lib;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
RhSolutionsMLBuilder.RebuildModel();
|
|
||||||
Console.WriteLine("Complete");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine(ex.Message);
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\RhSolutions.ML.Lib\RhSolutions.ML.Lib.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -36,7 +36,12 @@ public class RhSolutionsMLBuilder
|
|||||||
|
|
||||||
private static void SaveModelAsFile(MLContext mlContext, DataViewSchema trainingDataViewSchema, ITransformer model)
|
private static void SaveModelAsFile(MLContext mlContext, DataViewSchema trainingDataViewSchema, ITransformer model)
|
||||||
{
|
{
|
||||||
|
string path = Path.Combine(_appPath, "..", "..", "..", "..", "Models");
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
}
|
||||||
mlContext.Model.Save(model, trainingDataViewSchema,
|
mlContext.Model.Save(model, trainingDataViewSchema,
|
||||||
Path.Combine(_appPath, "..", "..", "..", "..", "Models", "model.zip"));
|
Path.Combine(path, "model.zip"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
using RhSolutions.ML.Lib;
|
||||||
|
|
||||||
namespace RhSolutions.ML.Tests;
|
namespace RhSolutions.ML.Tests;
|
||||||
|
|
||||||
public abstract class RhSolutionsTests
|
public abstract class RhSolutionsTests
|
||||||
@ -6,13 +8,13 @@ public abstract class RhSolutionsTests
|
|||||||
protected static string _dataPath = Path.Combine(_appPath, "..", "..", "..", "..", "Models", "model.zip");
|
protected static string _dataPath = Path.Combine(_appPath, "..", "..", "..", "..", "Models", "model.zip");
|
||||||
protected MLContext _mlContext;
|
protected MLContext _mlContext;
|
||||||
protected PredictionEngine<Product, TypePrediction> _predEngine;
|
protected PredictionEngine<Product, TypePrediction> _predEngine;
|
||||||
|
|
||||||
[SetUp]
|
public RhSolutionsTests()
|
||||||
public void Setup()
|
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute(string name, string expectedGroup)
|
public void Execute(string name, string expectedGroup)
|
||||||
@ -23,5 +25,5 @@ public abstract class RhSolutionsTests
|
|||||||
};
|
};
|
||||||
var prediction = _predEngine.Predict(p);
|
var prediction = _predEngine.Predict(p);
|
||||||
Assert.That(prediction.Type, Is.EqualTo(expectedGroup));
|
Assert.That(prediction.Type, Is.EqualTo(expectedGroup));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RhSolutions.ML.Tests", "RhS
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RhSolutions.ML.Lib", "RhSolutions.ML.Lib\RhSolutions.ML.Lib.csproj", "{36239F13-0F62-4AD7-B0AF-FA24E8101FA7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RhSolutions.ML.Lib", "RhSolutions.ML.Lib\RhSolutions.ML.Lib.csproj", "{36239F13-0F62-4AD7-B0AF-FA24E8101FA7}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RhSolutions.ML.Builder", "RhSolutions.ML.Builder\RhSolutions.ML.Builder.csproj", "{13C69C4E-6A1A-4646-8F2B-9C058E1B0FAD}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -23,10 +21,6 @@ Global
|
|||||||
{36239F13-0F62-4AD7-B0AF-FA24E8101FA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{36239F13-0F62-4AD7-B0AF-FA24E8101FA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{36239F13-0F62-4AD7-B0AF-FA24E8101FA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{36239F13-0F62-4AD7-B0AF-FA24E8101FA7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{36239F13-0F62-4AD7-B0AF-FA24E8101FA7}.Release|Any CPU.Build.0 = Release|Any CPU
|
{36239F13-0F62-4AD7-B0AF-FA24E8101FA7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{13C69C4E-6A1A-4646-8F2B-9C058E1B0FAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{13C69C4E-6A1A-4646-8F2B-9C058E1B0FAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{13C69C4E-6A1A-4646-8F2B-9C058E1B0FAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{13C69C4E-6A1A-4646-8F2B-9C058E1B0FAD}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
Loading…
Reference in New Issue
Block a user