Exemplo n.º 1
0
        private void RadialNeuralLearn()
        {
            if (learningDocInfo != null && learningDocInfo.SourceDir != Settings.Default.pathLearningDir)
            {
                learningDocInfo = null;
            }

            //ładuje listę kategorii
            DocumentClass.LoadFromFiles(Settings.Default.pathLearningDir, PreprocessingConsts.CategoryFilePattern);

            //stworzenie słownika
            dictionary = DictionaryFactory(Settings.Default.pathSummaryFile);
            //dictionary.LearningData = new List<DocClass.Src.Learning.LearningPair>();

            //stworzenie sieci
            radialNetwork = new RadialNetwork(Settings.Default.numberNeuronsHidden, DocumentClass.CategoriesCount);

            DocumentList dl = PreprocessingUtility.CreateLearningDocumentList(Settings.Default.pathLearningDir, dictionary, (DocumentRepresentationType)Settings.Default.documentRepresentationType, learningDocInfo);

            if (radialNetwork.Learn(dl) == false)
            {
                radialNetwork = null;
                dictionary    = null;
            }
        }
Exemplo n.º 2
0
        static void Main()
        {
            int classNum         = 20;
            TestDocumentList tdl = new TestDocumentList(100, 100);
            RadialNetwork    rn  = new RadialNetwork(50, classNum);

            for (int i = 0; i < classNum; i++)
            {
                DocumentClass.AddClass(i.ToString());
            }
            rn.Learn(tdl);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Odczytuje sieć nuronową z podanego pliku.
        /// </summary>
        /// <param name="pathFile">Scieżka do pliku.</param>
        public void LoadRadialNetwork(String pathFile)
        {
            Stream          stream     = File.Open(pathFile, FileMode.Open);
            BinaryFormatter bFormatter = new BinaryFormatter();

            this.radialNetwork                   = (RadialNetwork)bFormatter.Deserialize(stream);
            this.dictionary                      = (Dictionary)bFormatter.Deserialize(stream);
            this.learningDocInfo                 = (LearningDocInfo)bFormatter.Deserialize(stream);
            DocumentClass.DocumentCategories     = (List <String>)bFormatter.Deserialize(stream);
            this.learnDocumentRepresentationType = (DocumentRepresentationType)bFormatter.Deserialize(stream);
            this.learnDictionaryType             = (DictionaryType)bFormatter.Deserialize(stream);
            LoadSettings(stream, bFormatter);
            stream.Close();

            this.form.LoadClassificatorEnd(ClasyficatorType.RadialNeural);
        }
Exemplo n.º 4
0
        public FishRadialNN(int x, int y)
            : base(x, y)
        {
            this._nn        = new RadialNetwork(25);
            this._lightR    = this._nn.AddOutput();
            this._lightG    = this._nn.AddOutput();
            this._lightB    = this._nn.AddOutput();
            this._eyeR      = this._nn.AddInput();
            this._eyeG      = this._nn.AddInput();
            this._eyeB      = this._nn.AddInput();
            this._speed     = this._nn.AddOutput();
            this._rotation  = this._nn.AddOutput();
            this._proximity = this._nn.AddInput();

            this.X = x;
            this.Y = y;
        }