public SplitData GetData() { var inputs = new double[2, 4] { { 0, 0, 1, 1 }, { 0, 1, 1, 0 } }; var mathInputs = Matrix <double> .Build.DenseOfArray(inputs); var outputs = new double[1, 4] { { 0, 0, 1, 0 } }; var mathOutputs = Matrix <double> .Build.DenseOfArray(outputs); var data = new MathData(mathInputs, mathOutputs); return(new SplitData(data, data, data)); }
private SplitData ConvertToSplitData(string inputPath, string outputPath) { var input = ReadToCsv(inputPath); var inputMatrix = DenseMatrix.OfColumnArrays(input); var output = ReadToCsv(outputPath); var outputMatrix = DenseMatrix.OfColumnArrays(output); var inputSize = inputMatrix.RowCount; var outputSize = outputMatrix.RowCount; var dataSize = inputMatrix.ColumnCount; var trainingSize = 3 * dataSize / 5; var validationSize = dataSize / 5; var trainingInputs = inputMatrix.SubMatrix(0, inputSize, 0, trainingSize); var trainingOutputs = outputMatrix.SubMatrix(0, outputSize, 0, trainingSize); var training = new MathData(trainingInputs, trainingOutputs); var validationInputs = inputMatrix.SubMatrix(0, inputSize, trainingSize, validationSize); var validationOutputs = outputMatrix.SubMatrix(0, outputSize, trainingSize, validationSize); var validation = new MathData(validationInputs, validationOutputs); var testingInputs = inputMatrix.SubMatrix(0, inputSize, trainingSize + validationSize, dataSize - (trainingSize + validationSize)); var testingOutputs = outputMatrix.SubMatrix(0, outputSize, trainingSize + validationSize, dataSize - (trainingSize + validationSize)); var testing = new MathData(testingInputs, testingOutputs); return(new SplitData(training, validation, testing)); }
public SplitData(MathData trainingData, MathData validationData, MathData testData) { TrainingData = trainingData; ValidationData = validationData; TestData = testData; }