static public void AddtoTreeView(TreeNodeCollection treeNodeCollection)
 {
     foreach (WorldInfo WI in m_WorldList.Values)
     {
         WI.AddtoTreeView(treeNodeCollection, true);
     }
 }
Esempio n. 2
0
        public virtual void Backpropagate(double[,] oneHot, double[,] actualOutput, double[,] expectedOutput)
        {
            var errors = actualOutput.Minus(expectedOutput);

            //this is equal to hidden neurons' value
            var hiddenValue = oneHot.DotProduct(WI);

            //this is equal to hidden neurons' net_input_gradient
            var netInputGradient = WO.DotProduct(errors.Transpose());

            //this is equal to the output vectors' gradient value
            var outputValueGradient = errors.Transpose().DotProduct(hiddenValue);

            //this is equal to the input vectors' gradient value
            var inputValueGradient = netInputGradient.DotProduct(oneHot);

            WO = WO.Minus(outputValueGradient.DotScalar(LearningRate).Transpose());
            WI = WI.Minus(inputValueGradient.DotScalar(LearningRate).Transpose());
        }
    static void Main(string[] args)
    {
        WI     oWI = new WI(some_arg);
        string key = "mykey";

        if (!Dict.ContainsKey(key))
        {
            Dict.Add(key, oWI);
        }

        var before = Dict[key];

        Console.WriteLine($"Before: {before.Data}");

        oWI = new WI(another_arg);

        var after = Dict[key];

        Console.WriteLine($"After: {after.Data}");
    }
        static public void LoadMetadata(string filename)
        {
            StreamReader sr = null;

            try
            {
                sr = new StreamReader(filename, Encoding.UTF8);
                Dictionary <int, bool> CheckList = new Dictionary <int, bool>();

                string wstrStringRead;

                wstrStringRead = sr.ReadLine();
                if (wstrStringRead.IndexOf("##ScriptData##") == -1)
                {
                    MessageBox.Show("Not a Valid data file");
                    return;
                }

                wstrStringRead = sr.ReadLine();
                if (wstrStringRead.IndexOf("##Code##") == -1)
                {
                    MessageBox.Show("Not a Valid data file");
                    return;
                }
                else
                {
                    int    iTabPos = wstrStringRead.IndexOf("\t");
                    string Code    = wstrStringRead.Substring(iTabPos + 1);
                    Program.m_Form.textBoxCode.Text = Code;
                }

                do
                {
                    wstrStringRead = sr.ReadLine();

                    int    iTabPos    = wstrStringRead.IndexOf("\t");
                    string wstrIndex  = wstrStringRead.Substring(0, iTabPos);
                    int    iIndexRead = int.Parse(wstrIndex);

                    string wstrContent = "";
                    bool   bVal        = false;

                    // tab 을 찾은 경우에만 그 뒤의 내용을 읽어야 한다.
                    if (iTabPos != -1)
                    {
                        // tab 뒤에 있는 것들만 읽는다.
                        if ((iTabPos + 1) < wstrStringRead.Length)
                        {
                            wstrContent = wstrStringRead.Substring(iTabPos + 1);
                        }
                        int value = int.Parse(wstrContent);
                        if (value == 1)
                        {
                            bVal = true;
                        }
                        else
                        {
                            bVal = false;
                        }
                    }

                    CheckList.Add(iIndexRead, bVal);
                } while (sr.EndOfStream == false);

                foreach (WorldInfo WI in m_WorldList.Values)
                {
                    WI.LoadMetaData(CheckList);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            finally
            {
                if (sr != null)
                {
                    sr.Close();
                }
            }
        }