0
0

Remove RhSolutions.Console

This commit is contained in:
Serghei Cebotari 2023-12-29 00:05:17 +03:00
parent a3cc89ce04
commit 3be0df94c0
5 changed files with 13 additions and 37 deletions

View File

@ -1,11 +0,0 @@
using RhSolutions.ML.Lib;
try
{
RhSolutionsMLBuilder.RebuildModel();
Console.WriteLine("Complete");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

View File

@ -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>

View File

@ -36,7 +36,12 @@ public class RhSolutionsMLBuilder
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,
Path.Combine(_appPath, "..", "..", "..", "..", "Models", "model.zip"));
Path.Combine(path, "model.zip"));
}
}

View File

@ -1,3 +1,5 @@
using RhSolutions.ML.Lib;
namespace RhSolutions.ML.Tests;
public abstract class RhSolutionsTests
@ -7,9 +9,9 @@ public abstract class RhSolutionsTests
protected MLContext _mlContext;
protected PredictionEngine<Product, TypePrediction> _predEngine;
[SetUp]
public void Setup()
public RhSolutionsTests()
{
RhSolutionsMLBuilder.RebuildModel();
_mlContext = new MLContext(seed: 0);
ITransformer loadedNodel = _mlContext.Model.Load(_dataPath, out var _);
_predEngine = _mlContext.Model.CreatePredictionEngine<Product, TypePrediction>(loadedNodel);

View File

@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RhSolutions.ML.Tests", "RhS
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RhSolutions.ML.Lib", "RhSolutions.ML.Lib\RhSolutions.ML.Lib.csproj", "{36239F13-0F62-4AD7-B0AF-FA24E8101FA7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RhSolutions.ML.Builder", "RhSolutions.ML.Builder\RhSolutions.ML.Builder.csproj", "{13C69C4E-6A1A-4646-8F2B-9C058E1B0FAD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
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}.Release|Any CPU.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE