Esempio n. 1
0
 public BayesianNetwork(int size)
 {
     variables = new List<Variable>();
     nameToIndex = new Dictionary<string, int>();
     for (int i = 0; i < size; i++)
     {
         Variable v = new Variable(this, i);
         string variableName = "Variable_" + i;
         v.Name = variableName;
         nameToIndex[v.Name] = variables.Count;
         variables.Add(v);
     }
 }
Esempio n. 2
0
        private void Initialize(RecordFile recordFile)
        {
            // 変数名の設定
            for (int i = 0; i < recordFile.Header.Count; i++)
            {
                Variable v = new Variable(this, i);

                if (recordFile.HasHeader)
                {
                    v.Name = recordFile.Header[i];
                }
                else
                {
                    string variableName = "Variable_" + i;
                    v.Name = variableName;
                }

                nameToIndex[v.Name] = i;
                variables.Add(v);
            }

            // 値をセットする
            variables.ForEach(variable => variable.AddValues(recordFile));
        }