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 | 123 | 7/8/2024 |
1.6.3 | 105 | 6/6/2024 |
1.6.2 | 94 | 5/8/2024 |
1.6.1 | 114 | 4/27/2024 |
1.6.0 | 129 | 4/27/2024 |
1.5.9 | 125 | 4/27/2024 |
1.5.8 | 119 | 4/27/2024 |
1.5.7 | 123 | 4/22/2024 |
1.5.6 | 131 | 4/21/2024 |
1.5.5 | 135 | 4/11/2024 |
1.5.4 | 113 | 3/24/2024 |
1.5.3 | 159 | 2/27/2024 |
1.5.2 | 130 | 2/26/2024 |
1.5.1 | 138 | 2/26/2024 |
1.5.0 | 140 | 1/31/2024 |
1.4.9 | 130 | 1/25/2024 |
1.4.8 | 108 | 1/24/2024 |
1.4.7 | 100 | 1/24/2024 |
1.4.6 | 160 | 1/23/2024 |
1.4.5 | 208 | 12/17/2023 |
1.4.4 | 202 | 8/10/2023 |
1.4.3 | 191 | 8/6/2023 |
1.4.2 | 189 | 6/5/2023 |
1.4.1 | 254 | 3/14/2023 |
1.4.0 | 251 | 3/8/2023 |
1.3.9 | 265 | 3/2/2023 |
1.3.8 | 275 | 3/1/2023 |
1.3.7 | 278 | 2/27/2023 |
1.3.6 | 269 | 2/15/2023 |
1.3.5 | 341 | 11/29/2022 |
1.3.4 | 324 | 11/29/2022 |
1.3.3 | 425 | 11/28/2022 |
1.3.2 | 330 | 11/28/2022 |
1.3.1 | 344 | 11/28/2022 |
1.3.0 | 324 | 11/27/2022 |
1.2.9 | 347 | 11/27/2022 |
1.2.8 | 495 | 11/26/2022 |
1.2.7 | 339 | 11/26/2022 |
1.2.6 | 441 | 7/25/2022 |
1.2.5 | 435 | 7/25/2022 |
1.2.4 | 442 | 7/25/2022 |
1.2.3 | 439 | 7/25/2022 |
1.2.2 | 432 | 7/25/2022 |
1.2.1 | 452 | 6/22/2022 |
1.2.0 | 421 | 6/21/2022 |
1.1.9 | 459 | 6/21/2022 |
1.1.8 | 476 | 6/21/2022 |
1.1.7 | 446 | 6/20/2022 |
1.1.6 | 489 | 4/14/2022 |
1.1.5 | 451 | 4/14/2022 |
1.1.4 | 454 | 4/14/2022 |
1.1.3 | 455 | 4/14/2022 |
1.1.2 | 424 | 4/14/2022 |
1.1.1 | 453 | 4/14/2022 |
1.1.0 | 461 | 4/14/2022 |
1.0.9 | 477 | 2/14/2022 |
1.0.8 | 457 | 2/14/2022 |
1.0.7 | 448 | 2/14/2022 |
1.0.6 | 476 | 1/20/2022 |
1.0.5 | 313 | 1/15/2022 |
1.0.4 | 300 | 1/15/2022 |
1.0.3 | 519 | 1/12/2022 |
1.0.2 | 486 | 1/12/2022 |
1.0.1 | 359 | 1/12/2022 |
1.0.0 | 454 | 1/12/2022 |