Radiate 1.6.4
dotnet add package Radiate --version 1.6.4
NuGet\Install-Package Radiate -Version 1.6.4
<PackageReference Include="Radiate" Version="1.6.4" />
paket add Radiate --version 1.6.4
#r "nuget: Radiate, 1.6.4"
// Install Radiate as a Cake Addin #addin nuget:?package=Radiate&version=1.6.4 // Install Radiate as a Cake Tool #tool nuget:?package=Radiate&version=1.6.4
.NET port of Rust crate radiate.
Radiate
Nugets.
- Radiate - Core library
- Radiate.Data - Small toy datasets for testing implementations. Radiate.Examples uses these for examples.
- Radiate.Extensions - Extensions to the core library.
Build & run examples
dotnet run --project radiate.examples --configuration Release
Overview
Radiate consists of two main concepts:
1. Data pre-processing for model input/output
Radiate input/output data operates through a Tensor
object, a 3D float array wrapper which implements linear algebra functionality used throughout the library. To facilitate the pre-processing operations, Radiate uses a TensorFrame
- a collection of model feature tensors & target tensors. The TensorFrame
allows you to do common data pre-processing operations like Batch, Layer, Shift, Split, Reshape, Pad, Shuffle, Kernel, Transform. These options are held within the TensorFrame
for prediction data processing.
- Batch - Set a batch size to train on.
- Layer - Layer data by n rows.
- Split - Split the data into a training set and testing set. Default is 75% split training, 25% testing.
- Reshape - Reshape the row vector to a shape of (height, width, depth), useful for images.
- Pad - Pad an image Tensor with n zeros.
- Shuffle - Shuffle the rows of the dataset randomly.
- Kernel - Add kernel transform for the features, possible options are RBF, Polynomial, and Linear (None).
- Transform - Transform the feature or/and target data. Options are Normalize, Standardize, OHE (One Hot Encode), and Image (divide data point by 255).
2. Model/Engine configuration
Each AI/ML algorithm comes with its own set of configuration values. See the links above on each algorithm to view specifics.
- SupervisedEngine
- GeneticEngine
- Encode problems so they can be evolved through evolutionary computing
- Powerful Expression Tree/Graph based genetic engine for evolving complex problems.
Make Preditions
After training, the resting model can be put in a PredictionHarness<T>
to make live predictions.
var (inputs, targets) = await new XOR().LoadDataSet();
var data = new TensorFrame(features, targets).Transform(Norm.Standardize);
var neuralNet = new MultilayerPerceptron()
.Layer(new DenseInfo(64, Activation.ReLU))
.Layer(new DenseInfo(1, Activation.Linear));
var result = neuralNet.Fit(data).Take(100).ToResult();
var model = result.GetModel();
var harness = new PredictionHarness<MultilayerPerceptron>(model, data);
var output = harness.Predict(new float[] { 0f, 1f });
var predictionResult = output.Result; // The raw output of the model
var classification = output.Classification; // The class of the prediction
var confidence = output.Confidence; // The regression confidence of the prediction
Random
All random numbers are generated by calling RandomRegistry.GetRandom()
. This allows for random seeds to be set for model building.
// Every Random within this scope will use the same seed - resulting in the same result every time.
var (inputs, targets) = await new XOR().LoadDataSet();
RandomRegistry.Using(new Random(11), _ =>
{
var data = new TensorFrame(features, targets).Transform(Norm.Standardize);
var nn = new MultilayerPerceptron(grad)
.Layer(new DenseInfo(64, Activation.ReLU))
.Layer(new DenseInfo(1, Activation.Linear));
var result = nn.Fit(data).Take(MaxEpochs).ToResult();
});
Examples
Datasets coming from Radiate.Data
Convolutional Neural Network on MNist handwritten digets dataset
<img src="https://machinelearningmastery.com/wp-content/uploads/2019/02/Plot-of-a-Subset-of-Images-from-the-MNIST-Dataset-1024x768.png" width="300px">
const int FeatureLimit = 5000;
const int BatchSize = 128;
const int MaxEpochs = 10;
var (rawInputs, rawLabels) = await new Mnist(FeatureLimit).GetDataSet();
var data = new TensorFrame(rawInputs, rawLabels)
.Reshape(new Shape(28, 28, 1))
.Transform(Norm.Image, Norm.OHE)
.Batch(BatchSize)
.Split();
var neuralNet = new MultilayerPerceptron()
.Maximizing(AccuracyType.Classification)
.Layer(new ConvInfo(32, 3))
.Layer(new MaxPoolInfo(2))
.Layer(new FlattenInfo())
.Layer(new DenseInfo(64, Activation.Sigmoid))
.Layer(new SoftmaxInfo(data.OutputCategories))
var result = neuralNet.Fit(data)
.Take(MaxEpochs)
.ToResult();
Evolve a string
var target = "Austin, TX";
var codex = Codecs.CharCodex(target.Length);
var engine = Engine.Genetic(codex)
.Limit(Limit.Accuracy(Target.Length))
.SurvivorSelector(new ElitismSelector<CharGene>())
.ToEngine(pheno => pheno.Zip(Target).Sum(pair => pair.First == pair.Second ? 1f : 0f));
Console.WriteLine(engine.Fit()
.Peek(Displays.Metrics)
.ToModel());
More
See the examples for how to use the API.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Radiate:
Package | Downloads |
---|---|
Radiate.Extensions
Package Description |
|
Radiate.Data
Package Description |
|
Souk
Package Description |
|
Souk.Radiate
Package Description |
|
Radiate.Genetics
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.6.4 | 120 | 7/8/2024 |
1.6.3 | 102 | 6/6/2024 |
1.6.2 | 91 | 5/8/2024 |
1.6.1 | 111 | 4/27/2024 |
1.6.0 | 126 | 4/27/2024 |
1.5.9 | 122 | 4/27/2024 |
1.5.8 | 116 | 4/27/2024 |
1.5.7 | 120 | 4/22/2024 |
1.5.6 | 128 | 4/21/2024 |
1.5.5 | 132 | 4/11/2024 |
1.5.4 | 110 | 3/24/2024 |
1.5.3 | 156 | 2/27/2024 |
1.5.2 | 127 | 2/26/2024 |
1.5.1 | 135 | 2/26/2024 |
1.5.0 | 137 | 1/31/2024 |
1.4.9 | 127 | 1/25/2024 |
1.4.8 | 105 | 1/24/2024 |
1.4.7 | 97 | 1/24/2024 |
1.4.6 | 157 | 1/23/2024 |
1.4.5 | 205 | 12/17/2023 |
1.4.4 | 199 | 8/10/2023 |
1.4.3 | 188 | 8/6/2023 |
1.4.2 | 186 | 6/5/2023 |
1.4.1 | 251 | 3/14/2023 |
1.4.0 | 248 | 3/8/2023 |
1.3.9 | 262 | 3/2/2023 |
1.3.8 | 272 | 3/1/2023 |
1.3.7 | 275 | 2/27/2023 |
1.3.6 | 266 | 2/15/2023 |
1.3.5 | 336 | 11/29/2022 |
1.3.4 | 319 | 11/29/2022 |
1.3.3 | 418 | 11/28/2022 |
1.3.2 | 325 | 11/28/2022 |
1.3.1 | 339 | 11/28/2022 |
1.3.0 | 319 | 11/27/2022 |
1.2.9 | 342 | 11/27/2022 |
1.2.8 | 489 | 11/26/2022 |
1.2.7 | 333 | 11/26/2022 |
1.2.6 | 438 | 7/25/2022 |
1.2.5 | 432 | 7/25/2022 |
1.2.4 | 439 | 7/25/2022 |
1.2.3 | 436 | 7/25/2022 |
1.2.2 | 429 | 7/25/2022 |
1.2.1 | 449 | 6/22/2022 |
1.2.0 | 418 | 6/21/2022 |
1.1.9 | 456 | 6/21/2022 |
1.1.8 | 473 | 6/21/2022 |
1.1.7 | 443 | 6/20/2022 |
1.1.6 | 486 | 4/14/2022 |
1.1.5 | 448 | 4/14/2022 |
1.1.4 | 451 | 4/14/2022 |
1.1.3 | 452 | 4/14/2022 |
1.1.2 | 419 | 4/14/2022 |
1.1.1 | 450 | 4/14/2022 |
1.1.0 | 458 | 4/14/2022 |
1.0.9 | 474 | 2/14/2022 |
1.0.8 | 454 | 2/14/2022 |
1.0.7 | 445 | 2/14/2022 |
1.0.6 | 473 | 1/20/2022 |
1.0.5 | 310 | 1/15/2022 |
1.0.4 | 295 | 1/15/2022 |
1.0.3 | 516 | 1/12/2022 |
1.0.2 | 483 | 1/12/2022 |
1.0.1 | 356 | 1/12/2022 |
1.0.0 | 451 | 1/12/2022 |