protected Vector[] ConvertDataToSequence(NeuralNetworkData data)
 {
     CheckConditionOnException(data.DataType != NeuralNetworkDataType.SequenceOfVectors, "Recurrent neural network implements the 'sequence to sequence' approach, " +
                               "so the input shape must contain only a sequence of vectors. For example: " +
                               "nt.Run(new NeuralNetworkData(new Vector[] { new [] { 0.0, 0.3 }, new [] { 0.4, 0.7 } }))");
     return(data.Shape.Values.First());
 }
        public override NeuralNetworkResult Run(NeuralNetworkData inputData)
        {
            var input  = ConvertDataToVector(inputData);
            var output = Run(input);

            return(new NeuralNetworkResult(output));
        }
        public override NeuralNetworkResult Run(NeuralNetworkData inputData)
        {
            var inputs  = ConvertDataToSequence(inputData);
            var outputs = Run(inputs);

            return(new NeuralNetworkResult(outputs));
        }
        public override NeuralNetworkLearnResult Learn(NeuralNetworkData inputData, NeuralNetworkData idealData)
        {
            var input = ConvertDataToVector(inputData);
            var ideal = ConvertDataToVector(idealData);

            var(output, error) = Learn(input, ideal);
            return(new NeuralNetworkLearnResult(output, error));
        }
        public override NeuralNetworkLearnResult Learn(NeuralNetworkData inputData, NeuralNetworkData idealData)
        {
            var inputs = ConvertDataToSequence(inputData);
            var ideals = ConvertDataToSequence(idealData);

            var(outputs, errors) = Learn(inputs, ideals);
            return(new NeuralNetworkLearnResult(outputs, errors));
        }
 public override NeuralNetworkLearnResult Learn(NeuralNetworkData inputData)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 protected Vector ConvertDataToVector(NeuralNetworkData data)
 {
     CheckConditionOnException(data.DataType != NeuralNetworkDataType.Vector, "Perceptron implements the 'one to one' approach, " +
                               "so the input shape must contain only a single vector. For example: nt.Run(new NeuralNetworkData(new [] { 0.0, 0.3 }))");
     return(data.Shape.Values.First().First().Copy());
 }
 public abstract NeuralNetworkLearnResult Learn(NeuralNetworkData inputData);
 public abstract NeuralNetworkResult Run(NeuralNetworkData inputData);