public void FeedForwardNeuralNetwork_LoadModelSparseMatrix() { var target = new FeedForwardNeuralNetwork <double>( new[] { 2L, 3L, 2L }); var parser = new DoubleParser <string>(); var matrix = TestsHelper.ReadMatrix( 5, 5, "[[-1.0, 1.0, 0.5, 0, 0], [1.0, -1.0, 0.5, 0, 0], [0, 0, 0, -1.0, 2.0], [0, 0, 0, 0.5, -1.5], [0, 0, 0, 1.0, -0.5]]", (i, j) => new SparseDictionaryMatrix <double>(i, j, 0), parser, true); var vector = TestsHelper.ReadVector( 5, "[-1.0, 0.0, 1.0, -0.5, 0.5]", new SparseDictionaryMathVectorFactory <double>(), parser, true); var model = new NeuralNetworkModel <double, SparseDictionaryMatrix <double>, IMathVector <double> >( matrix, vector); target.LoadModelSparse <SparseDictionaryMatrix <double>, ILongSparseMatrixLine <double>, IMathVector <double> >( model); this.AssertTargetFromMatrix( model, target); }
public void FeedForwardNeuralNetwork_LoadModelComplexDisconnectedSparseMatrix() { var schema = new[] { 5L, 3L, 4L, 2L, 5L }; var target = new FeedForwardNeuralNetwork <double>( schema); var model = this.GetComplexUnconnectedTestModel(); target.LoadModelSparse <CoordinateSparseMathMatrix <double>, ILongSparseMatrixLine <double>, ArrayMathVector <double> >( model); // Verificação do carregamento this.AssertTargetFromMatrix( model, target); }