-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using System; | ||
using System.Threading.Tasks; | ||
using MathNet.Numerics.LinearAlgebra; | ||
|
||
namespace Nexuria.NeuroNetwork | ||
{ | ||
class Program | ||
{ | ||
static async Task Main(string[] args) | ||
{ | ||
var serviceProvider = BuildServiceProvider(); | ||
var neuroNetwork = serviceProvider.GetService<NeuroNetwork>(); | ||
|
||
await neuroNetwork.InitializeAsync(); | ||
await neuroNetwork.TrainAsync(Matrix<double>.Build.Dense(10, 10), Matrix<double>.Build.Dense(10, 1)); | ||
|
||
Console.WriteLine("Press any key to exit..."); | ||
Console.ReadKey(); | ||
|
||
await neuroNetwork.PredictAsync(Matrix<double>.Build.Dense(10, 1)); | ||
} | ||
|
||
static IServiceProvider BuildServiceProvider() | ||
{ | ||
var configuration = new ConfigurationBuilder() | ||
.AddJsonFile("appsettings.json") | ||
.Build(); | ||
|
||
var serviceProvider = new ServiceCollection() | ||
.AddLogging(logging => | ||
{ | ||
logging.AddConsole(); | ||
logging.AddDebug(); | ||
}) | ||
.AddSingleton<NeuroNetwork>() | ||
.AddSingleton<NeuroNetworkOptions>() | ||
.AddSingleton<IConfiguration>(configuration) | ||
.BuildServiceProvider(); | ||
|
||
return serviceProvider; | ||
} | ||
} | ||
} |