I have multiples inputs , but most of them are List array and i dont know how can i configure my neural network to accept list array as an input.
Here i have a example XOR(but the inputs are just floats and i cant change to List array):
`
using SiaNet;
using SiaNet.Data;
using SiaNet.Engine;
using SiaNet.Events;
using SiaNet.Layers;
using System;
namespace Sia_XOR
{
class Program
{
static void Main(string[] args)
{
//1º- Setup Engine
Global.UseEngine(SiaNet.Backend.ArrayFire.SiaNetBackend.Instance, DeviceType.CPU);
//2º -Prep Data
var (x, y) = PrepDataset();
DataFrameIter trainSet = new DataFrameIter(x, y);
//Build model with simple fully connected layers
var model = new Sequential();
model.EpochEnd += Model_EpochEnd;
model.Add(new Dense(64, ActType.ReLU));
model.Add(new Dense(1, ActType.Sigmoid));
//Compile with Optimizer, Loss and Metric
model.Compile(OptimizerType.SGD, LossType.MeanSquaredError, MetricType.BinaryAccurary);
// Train for 1000 epoch with batch size of 2
model.Train(trainSet, epochs: 300, batchSize: 2);
//Create prediction data to evaluate
DataFrame2D predX = new DataFrame2D(2);
predX.Load(0, 0, 0, 1); //Result should be 0 and 1
var rawPred = model.Predict(predX);
Global.CurrentBackend.Round(rawPred).Print();
Console.ReadLine();
}
#region DataSet
private static (DataFrame2D, DataFrame2D) PrepDataset()
{
// We will prepare XOR gate dataset which will be treated as classification problem.
// More about this: https://medium.com/@jayeshbahire/the-xor-problem-in-neural-networks-50006411840b
DataFrame2D x = new DataFrame2D(2);
x.Load(new float[] { 0, 0, 0, 1, 1, 0, 1, 1 });
DataFrame2D y = new DataFrame2D(1);
y.Load(new float[] { 0, 1, 1, 0 });
return (x, y);
}
#endregion
private static void Model_EpochEnd(object sender, EpochEndEventArgs e)
{
Console.WriteLine("Epoch: {0}, Loss: {1}, Metric: {2}", e.Epoch, e.Loss, e.Metric);
}
}
I have multiples inputs , but most of them are List array and i dont know how can i configure my neural network to accept list array as an input. Here i have a example XOR(but the inputs are just floats and i cant change to List array):
` using SiaNet; using SiaNet.Data; using SiaNet.Engine; using SiaNet.Events; using SiaNet.Layers; using System;
namespace Sia_XOR { class Program { static void Main(string[] args) { //1º- Setup Engine Global.UseEngine(SiaNet.Backend.ArrayFire.SiaNetBackend.Instance, DeviceType.CPU);
}`