Пример #1
0
        public NeuralNetworkDTO ToDTO()
        {
            var species = new SpeciesDTO[_speciesStack.Count];

            for (var i = 0; i < species.Length; i++)
            {
                species[i] = _speciesStack[i].ToDTO();
            }
            return(new NeuralNetworkDTO()
            {
                Layers = _layers,
                Species = species
            });
        }
Пример #2
0
        public SpeciesDTO ToDTO()
        {
            var result = new SpeciesDTO();

            result.Fitness      = Fitness;
            result.FamilyFactor = FamilyFactor;
            result.Weights      = new TensorDTO[Weights.Length];
            for (var i = 0; i < Weights.Length; i++)
            {
                result.Weights[i] = Weights[i].ToDTO();
            }
            result.Biases = new TensorDTO[Biases.Length];
            for (var i = 0; i < Biases.Length; i++)
            {
                result.Biases[i] = Biases[i].ToDTO();
            }
            result.FirstParent        = FirstParent;
            result.HistoricMaxFitness = HistoricMaxFitness;
            result.BestStage          = BestStage;
            result.HistoricStage      = HistoricStage;
            return(result);
        }
Пример #3
0
        public static Species FromDTO(SpeciesDTO dto)
        {
            var result = new Species();

            result.Fitness      = dto.Fitness;
            result.FamilyFactor = dto.FamilyFactor;
            result.Weights      = new Tensor[dto.Weights.Length];
            for (var i = 0; i < dto.Weights.Length; i++)
            {
                result.Weights[i] = Tensor.NewFromDTO(dto.Weights[i]);
            }
            result.Biases = new Tensor[dto.Biases.Length];
            for (var i = 0; i < dto.Biases.Length; i++)
            {
                result.Biases[i] = Tensor.NewFromDTO(dto.Biases[i]);
            }
            result.FirstParent        = dto.FirstParent;
            result.HistoricMaxFitness = dto.HistoricMaxFitness;
            result.BestStage          = dto.BestStage;
            result.HistoricStage      = dto.HistoricStage;
            return(result);
        }