Пример #1
0
        public override void DeserializeAttributes(PersistenceReader ip)
        {
            m_Value  = ip.GetString("v");
            m_Format = Utility.Intern(ip.GetString("f"));

            if (m_Format == null)
            {
                Utility.Intern(ref m_Value);
            }
        }
Пример #2
0
        public void Deserialize(PersistenceReader ip)
        {
            DeserializeAttributes(ip);

            if (ip.BeginChildren())
            {
                DeserializeChildren(ip);
                ip.FinishChildren();
            }
        }
Пример #3
0
        public override void DeserializeChildren(PersistenceReader ip)
        {
            while (ip.HasChild)
            {
                PersistableObject child = ip.GetChild();

                if (child is ReportColumn)
                {
                    m_Columns.Add((ReportColumn)child);
                }
                else if (child is ReportItem)
                {
                    m_Items.Add((ReportItem)child);
                }
            }
        }
Пример #4
0
 public override void DeserializeAttributes(PersistenceReader ip)
 {
     m_Name  = Utility.Intern(ip.GetString("n"));
     m_Width = Utility.Intern(ip.GetString("w"));
 }
Пример #5
0
 public override void DeserializeAttributes(PersistenceReader ip)
 {
     m_Name  = Utility.Intern(ip.GetString("n"));
     m_Value = ip.GetInt32("v");
 }
Пример #6
0
        public override void DeserializeAttributes(PersistenceReader ip)
        {
            base.DeserializeAttributes(ip);

            m_ShowPercents = ip.GetBoolean("p");
        }
        /// <summary>
        /// Load an already trained model
        /// </summary>
        /// <param name="reader"></param>
        protected override void LoadContent(PersistenceReader reader)
        {
            reader.OpenScope((PersistItemTag)Persistent.Parameters);
            reader.GetValue(out C);
            reader.GetValue(out cacheSize);
            reader.GetValue(out maximumInput);
            reader.GetValue(out lowerOrder);
            reader.GetValue(out exponent);
            reader.GetValue(out gamma);
            reader.GetValue(out strKernelType);
            reader.CloseScope();

            reader.OpenScope((PersistItemTag)Persistent.Classifiers);
            int length = 0;

            reader.GetValue(out length);
            classifiers = new Avanade.Datamining.SMO.SMO[length][];
            for (int i = 0; i < classifiers.Length; i++)
            {
                classifiers[i] = new Avanade.Datamining.SMO.SMO[length];
                for (int j = i + 1; j < classifiers.Length; j++)
                {
                    classifiers[i][j] = new Avanade.Datamining.SMO.SMO();
                    reader.GetValue(out classifiers[i][j].b);

                    int instLength = 0;
                    reader.GetValue(out instLength);
                    Instances inst = new Instances(new Instance[instLength], this.getLabels(), 0);

                    for (int x = 0; x < instLength; x++)
                    {
                        int posLength = 0;
                        reader.GetValue(out posLength);
                        int[]    positions = new int[posLength];
                        double[] values    = new double[posLength];
                        for (int y = 0; y < posLength; y++)
                        {
                            reader.GetValue(out positions[y]);
                            reader.GetValue(out values[y]);
                        }
                        int label = 0;
                        reader.GetValue(out label);
                        Instance instance = new Instance(1, label, new double[] { });
                        instance.values    = values;
                        instance.positions = positions;
                        inst.instances[x]  = instance;
                    }
                    classifiers[i][j].kernel = getKernel(inst);

                    int supportvectorslength = 0;
                    reader.GetValue(out supportvectorslength);
                    LinkedList <int> supportVectors = new LinkedList <int>();
                    for (int x = 0; x < supportvectorslength; x++)
                    {
                        int s = 0;
                        reader.GetValue(out s);
                        supportVectors.AddLast(s);
                    }
                    classifiers[i][j].supportVectors = supportVectors;

                    int alphaLength = 0;
                    reader.GetValue(out alphaLength);
                    double[] alphas = new double[alphaLength];

                    for (int x = 0; x < alphas.Length; x++)
                    {
                        reader.GetValue(out alphas[x]);
                    }
                    classifiers[i][j].alpha = alphas;

                    int labelLength = 0;
                    reader.GetValue(out labelLength);
                    double[] labels = new double[labelLength];

                    for (int x = 0; x < labels.Length; x++)
                    {
                        reader.GetValue(out labels[x]);
                    }
                    classifiers[i][j].labels = labels;
                }
            }
            reader.CloseScope();
        }
Пример #8
0
 public virtual void DeserializeChildren(PersistenceReader ip)
 {
 }
Пример #9
0
 public virtual void DeserializeAttributes(PersistenceReader ip)
 {
 }