Exemple #1
0
        public static NeuronNetwork MakeFromXmlFile(string xmlFilename)
        {
            try
            {
                NeuronNetwork nn = null;
                var doc = new XmlDocument();
                doc.Load(xmlFilename);
                string concreteType = doc.SelectSingleNode("/NeuronNetwork").Attributes["ConcreteType"].Value;

                if (concreteType == "DetectWinnerNeuronNetwork")
                {
                    nn = new DetectWinnerNeuronNetwork();
                }
                else if (concreteType == "DetectLifeLongshotNeuronNetwork")
                {
                    nn = new ChooseBetweenFirstAndSecondFavoriteNeuronNetwork();
                }
                else if (concreteType == "ChooseBetweenFirstAndSecondFavoriteNeuronNetwork")
                {
                    nn = new ChooseBetweenFirstAndSecondFavoriteNeuronNetwork();
                }
                // new concrete types are going here.....

                if(null != nn)
                {
                    nn.Filename = xmlFilename;
                    nn.LoadFromXmlFile(doc);
                }

                return nn;
            }
            catch
            {
                return null;
            }
        }
Exemple #2
0
        public static NeuronNetwork Make(INeuronNetworkConstructor constructionInfo)
        {
            NeuronNetwork nn = null;

            if(constructionInfo is DetectWinnerNeuronNetworkConstructor)
            {
                var ci = constructionInfo as DetectWinnerNeuronNetworkConstructor;
                nn = new DetectWinnerNeuronNetwork(ci.NumberOfPastPerformancesToUse, ci.FieldSize);
            }
            else if (constructionInfo is ChooseBetweenFirstAndSecondFavoriteNeuronNetworkConstructor)
            {
                var ci = constructionInfo as ChooseBetweenFirstAndSecondFavoriteNeuronNetworkConstructor;

                nn = new ChooseBetweenFirstAndSecondFavoriteNeuronNetwork(ci);
            }

            if (null != nn)
            {
                nn.CreateInputLayer();

            }

            return nn;
        }