Ejemplo n.º 1
0
 public void TestRead()
 {
     var enc = new ASCIIEncoding();
     var bis = new MemoryStream(enc.GetBytes(XML));
     var read = new ReadXML(bis);
     Assert.AreEqual(0, read.Read());
     Assert.IsTrue(read.IsIt("doc", true));
     Assert.AreEqual(0, read.Read());
     Assert.IsTrue(read.IsIt("a", true));
     Assert.AreEqual('a', read.Read());
     Assert.AreEqual(0, read.Read());
     Assert.IsTrue(read.IsIt("a", false));
     bis.Close();
 }
Ejemplo n.º 2
0
        public void TestRead()
        {
            var enc  = new ASCIIEncoding();
            var bis  = new MemoryStream(enc.GetBytes(XML));
            var read = new ReadXML(bis);

            Assert.AreEqual(0, read.Read());
            Assert.IsTrue(read.IsIt("doc", true));
            Assert.AreEqual(0, read.Read());
            Assert.IsTrue(read.IsIt("a", true));
            Assert.AreEqual('a', read.Read());
            Assert.AreEqual(0, read.Read());
            Assert.IsTrue(read.IsIt("a", false));
            bis.Close();
        }
        /// <summary>
        /// Handle the properties tag.
        /// </summary>
        /// <param name="xmlin">The XML reader.</param>
        private void HandleProperties(ReadXML xmlin)
        {
            while (xmlin.ReadToTag())
            {
                if (xmlin.IsIt(PropertyDataPersistor.TAG_PROPERTY, true))
                {
                    HandleProperty(xmlin);
                }
                else if (xmlin.IsIt(PropertyDataPersistor.TAG_PROPERTIES, false))
                {
                    break;
                }

            }

        }
        /// <summary>
        /// Load the specified Encog object from an XML reader.
        /// </summary>
        /// <param name="xmlIn">The XML reader to use.</param>
        /// <returns>The loaded object.</returns>
        public IEncogPersistedObject Load(ReadXML xmlIn)
        {
            WeightedSynapse synapse = new WeightedSynapse();

            String end = xmlIn.LastTag.Name;

            while (xmlIn.ReadToTag())
            {

                if (xmlIn.IsIt(WeightedSynapsePersistor.TAG_WEIGHTS, true))
                {
                    xmlIn.ReadToTag();
                    synapse.WeightMatrix = PersistorUtil.LoadMatrix(xmlIn);
                }
                if (xmlIn.IsIt(end, false))
                {
                    break;
                }
            }

            return synapse;
        }
        /// <summary>
        /// Load the specified Encog object from an XML reader.
        /// </summary>
        /// <param name="xmlIn">The XML reader to use.</param>
        /// <returns>The loaded object.</returns>
        public IEncogPersistedObject Load(ReadXML xmlIn)
        {

            String name = xmlIn.LastTag.Attributes[EncogPersistedCollection.ATTRIBUTE_NAME];
            String description = xmlIn.LastTag.Attributes[
                   EncogPersistedCollection.ATTRIBUTE_DESCRIPTION];

            this.currentNetwork = new BasicNetwork();
            this.currentNetwork.Name = name;
            this.currentNetwork.Description = description;

            while (xmlIn.ReadToTag())
            {
                if (xmlIn.IsIt(BasicNetworkPersistor.TAG_LAYERS, true))
                {
                    HandleLayers(xmlIn);
                }
                else if (xmlIn.IsIt(BasicNetworkPersistor.TAG_SYNAPSES, true))
                {
                    HandleSynapses(xmlIn);
                }
                else if (xmlIn.IsIt(BasicNetworkPersistor.TAG_PROPERTIES, true))
                {
                    HandleProperties(xmlIn);
                }
                else if (xmlIn.IsIt(BasicNetworkPersistor.TAG_LOGIC, true))
                {
                    HandleLogic(xmlIn);
                }
                else if (xmlIn.IsIt(BasicNetworkPersistor.TAG_TAGS, true))
                {
                    HandleTags(xmlIn);
                }
                else if (xmlIn.IsIt(EncogPersistedCollection.TYPE_BASIC_NET, false))
                {
                    break;
                }

            }
            this.currentNetwork.Structure.FinalizeStructure();
            return this.currentNetwork;
        }
 /// <summary>
 /// Process any synapses that should be loaded.
 /// </summary>
 /// <param name="xmlIn">The XML reader.</param>
 private void HandleSynapses(ReadXML xmlIn)
 {
     String end = xmlIn.LastTag.Name;
     while (xmlIn.ReadToTag())
     {
         if (xmlIn.IsIt(BasicNetworkPersistor.TAG_SYNAPSE, true))
         {
             int from = xmlIn.LastTag.GetAttributeInt(
                    BasicNetworkPersistor.ATTRIBUTE_FROM);
             int to = xmlIn.LastTag.GetAttributeInt(
                    BasicNetworkPersistor.ATTRIBUTE_TO);
             xmlIn.ReadToTag();
             IPersistor persistor = PersistorUtil.CreatePersistor(xmlIn
                    .LastTag.Name);
             ISynapse synapse = (ISynapse)persistor.Load(xmlIn);
             synapse.FromLayer = this.index2layer[from];
             synapse.ToLayer = this.index2layer[to];
             synapse.FromLayer.AddSynapse(synapse);
         }
         if (xmlIn.IsIt(end, false))
         {
             break;
         }
     }
 }
        /// <summary>
        /// Handle any layers that should be loaded.
        /// </summary>
        /// <param name="xmlIn">The XML reader.</param>
        private void HandleLayers(ReadXML xmlIn)
        {
            String end = xmlIn.LastTag.Name;
            while (xmlIn.ReadToTag())
            {
                if (xmlIn.IsIt(BasicNetworkPersistor.TAG_LAYER, true))
                {
                    int num = xmlIn.LastTag.GetAttributeInt(
                           BasicNetworkPersistor.ATTRIBUTE_ID);
                    String type = xmlIn.LastTag.GetAttributeValue(
                           BasicNetworkPersistor.ATTRIBUTE_TYPE);
                    xmlIn.ReadToTag();
                    IPersistor persistor = PersistorUtil.CreatePersistor(xmlIn
                           .LastTag.Name);
                    ILayer layer = (ILayer)persistor.Load(xmlIn);
                    this.index2layer[num] = layer;

                    // the type attribute is actually "legacy", but if its there
                    // then use it!
                    if (type != null)
                    {
                        if (type.Equals(BasicNetworkPersistor.ATTRIBUTE_TYPE_INPUT))
                        {
                            this.currentNetwork.TagLayer(BasicNetwork.TAG_INPUT,
                                    layer);
                        }
                        else if (type
                                .Equals(BasicNetworkPersistor.ATTRIBUTE_TYPE_OUTPUT))
                        {
                            this.currentNetwork.TagLayer(BasicNetwork.TAG_OUTPUT,
                                    layer);
                        }
                        else if (type
                              .Equals(BasicNetworkPersistor.ATTRIBUTE_TYPE_BOTH))
                        {
                            this.currentNetwork.TagLayer(BasicNetwork.TAG_INPUT,
                                    layer);
                            this.currentNetwork.TagLayer(BasicNetwork.TAG_OUTPUT,
                                    layer);
                        }
                    }
                    // end of legacy processing
                }
                if (xmlIn.IsIt(end, false))
                {
                    break;
                }
            }
        }
        /// <summary>
        /// Load the data from a model.
        /// </summary>
        /// <param name="xmlin">Where to read the data from.</param>
        /// <param name="model">The model to load data into.</param>
        private void HandleData(ReadXML xmlin, svm_model model)
        {
            int i = 0;
            int m = model.nr_class - 1;
            int l = model.l;

            model.sv_coef = EngineArray.AllocateDouble2D(m, l);
            model.SV = new svm_node[l][];

            while (xmlin.ReadToTag())
            {
                if (xmlin.IsIt(SVMNetworkPersistor.TAG_ROW, true))
                {
                    String line = xmlin.ReadTextToTag();

                    String[] st = xmlin.ReadTextToTag().Split(',');

                    for (int k = 0; k < m; k++)
                        model.sv_coef[k][i] = Double.Parse(st[i]);
                    int n = st.Length / 2;
                    model.SV[i] = new svm_node[n];
                    int idx = 0;
                    for (int j = 0; j < n; j++)
                    {
                        model.SV[i][j] = new svm_node();
                        model.SV[i][j].index = int.Parse(st[idx++]);
                        model.SV[i][j].value_Renamed = Double.Parse(st[idx++]);
                    }
                    i++;
                }
                else if (xmlin.IsIt(SVMNetworkPersistor.TAG_DATA, false))
                {
                    break;
                }
            }
        }
        /// <summary>
        /// Load the specified Encog object from an XML reader.
        /// </summary>
        /// <param name="xmlin">The XML reader to use.</param>
        /// <returns>The loaded object.</returns>
        public IEncogPersistedObject Load(ReadXML xmlin)
        {
            String name = xmlin.LastTag.Attributes[
                   EncogPersistedCollection.ATTRIBUTE_NAME];
            String description = xmlin.LastTag.Attributes[
                   EncogPersistedCollection.ATTRIBUTE_DESCRIPTION];

            this.propertyData = new PropertyData();

            this.propertyData.Name = name;
            this.propertyData.Description = description;

            while (xmlin.ReadToTag())
            {
                if (xmlin.IsIt(PropertyDataPersistor.TAG_PROPERTIES, true))
                {
                    HandleProperties(xmlin);
                }
                else if (xmlin.IsIt(EncogPersistedCollection.TYPE_PROPERTY, false))
                {
                    break;
                }

            }

            return this.propertyData;
        }
        /// <summary>
        /// Load the object.
        /// </summary>
        /// <param name="xmlin">The XML object to load from.</param>
        /// <returns>The loaded object.</returns>
        public IEncogPersistedObject Load(ReadXML xmlin)
        {
            this.current = new TrainingContinuation();

            String name = xmlin.LastTag.Attributes[
                    EncogPersistedCollection.ATTRIBUTE_NAME];
            String description = xmlin.LastTag.Attributes[
                    EncogPersistedCollection.ATTRIBUTE_DESCRIPTION];

            this.current.Name = name;
            this.current.Description = description;

            while (xmlin.ReadToTag())
            {
                if (xmlin.IsIt(TrainingContinuationPersistor.TAG_ITEMS, true))
                {
                    HandleItems(xmlin);
                }
                else if (xmlin.IsIt(
                    EncogPersistedCollection.TYPE_TRAINING_CONTINUATION, false))
                {
                    break;
                }
            }

            return this.current;
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Load a matrix from the reader.
        /// </summary>
        /// <param name="xmlIn">The XML reader.</param>
        /// <returns>The loaded matrix.</returns>
        public static Matrix LoadMatrix(ReadXML xmlIn)
        {
            int rows = xmlIn.LastTag.GetAttributeInt(
                   PersistorUtil.ATTRIBUTE_MATRIX_ROWS);
            int cols = xmlIn.LastTag.GetAttributeInt(
                   PersistorUtil.ATTRIBUTE_MATRIX_COLS);
            Matrix matrix = new Matrix(rows, cols);

            int row = 0;

            String end = xmlIn.LastTag.Name;
            while (xmlIn.ReadToTag())
            {
                if (xmlIn.IsIt(end, false))
                {
                    break;
                }
                if (xmlIn.IsIt(PersistorUtil.ROW, true))
                {
                    String str = xmlIn.ReadTextToTag();
                    double[] d = NumberList.FromList(CSVFormat.EG_FORMAT, str);
                    for (int col = 0; col < d.Length; col++)
                    {
                        matrix[row, col] = d[col];
                    }
                    row++;
                }
            }

            return matrix;
        }
        /// <summary>
        /// Load the specified Encog object from an XML reader.
        /// </summary>
        /// <param name="xmlIn">The XML reader to use.</param>
        /// <returns>The loaded object.</returns>
        public IEncogPersistedObject Load(ReadXML xmlIn)
        {

            String name = xmlIn.LastTag.Attributes[
                   EncogPersistedCollection.ATTRIBUTE_NAME];
            String description = xmlIn.LastTag.GetAttributeValue(
                   EncogPersistedCollection.ATTRIBUTE_DESCRIPTION);

            this.currentDataSet = new BasicNeuralDataSet();
            this.currentDataSet.Name = name;
            this.currentDataSet.Description = description;

            while (xmlIn.ReadToTag())
            {
                if (xmlIn.IsIt(BasicNeuralDataSetPersistor.TAG_ITEM, true))
                {
                    HandleItem(xmlIn);
                }
                else if (xmlIn.IsIt(EncogPersistedCollection.TYPE_TRAINING, false))
                {
                    break;
                }

            }

            return this.currentDataSet;
        }
        /// <summary>
        /// Load a RBF layer. 
        /// </summary>
        /// <param name="xmlin">The XML to read from.</param>
        /// <returns>The object that was loaded.</returns>
        public IEncogPersistedObject Load(ReadXML xmlin)
        {
            int neuronCount = 0;
            int x = 0;
            int y = 0;
            int dimensions = 1;
            IRadialBasisFunction[] rbfs = new IRadialBasisFunction[0];

            String end = xmlin.LastTag.Name;

            while (xmlin.ReadToTag())
            {
                if (xmlin.IsIt(BasicLayerPersistor.PROPERTY_NEURONS, true))
                {
                    neuronCount = xmlin.ReadIntToTag();
                }
                else if (xmlin.IsIt(BasicLayerPersistor.PROPERTY_X, true))
                {
                    x = xmlin.ReadIntToTag();
                }
                else if (xmlin.IsIt(BasicLayerPersistor.PROPERTY_Y, true))
                {
                    y = xmlin.ReadIntToTag();
                }
                else if (xmlin.IsIt(RadialBasisFunctionLayerPersistor.PROPERTY_RBF,
                      true))
                {
                    rbfs = LoadAllRBF(xmlin);
                }
                else if (xmlin.IsIt(end, false))
                {
                    break;
                }
            }

            RadialBasisFunctionLayer layer = new RadialBasisFunctionLayer(neuronCount);
            layer.RadialBasisFunction = rbfs;
            layer.X = x;
            layer.Y = y;

            return layer;
        }
        private IRadialBasisFunction LoadRBF(String name, ReadXML xmlin)
        {

            String clazz = ReflectionUtil.ResolveEncogClass(name);

            if (clazz == null)
            {
                throw new NeuralNetworkError("Unknown RBF function type: " + name);
            }

            IRadialBasisFunction result = (IRadialBasisFunction)ReflectionUtil.LoadObject(clazz);

            while (xmlin.ReadToTag())
            {
                if (xmlin.IsIt(name, false))
                {
                    break;
                }
                else if (xmlin.IsIt(PROPERTY_CENTERS, true))
                {
                    String str = xmlin.ReadTextToTag();
                    double[] centers = NumberList.FromList(CSVFormat.EG_FORMAT, str);
                    result.Centers = centers;
                }
                else if (xmlin.IsIt(PROPERTY_PEAK, true))
                {
                    String str = xmlin.ReadTextToTag();
                    double d = Double.Parse(str);
                    result.Peak = d;
                }
                else if (xmlin.IsIt(PROPERTY_WIDTH, true))
                {
                    String str = xmlin.ReadTextToTag();
                    double d = Double.Parse(str);
                    result.Width = d;
                }
            }

            return result;
        }
        private IRadialBasisFunction[] LoadAllRBF(ReadXML xmlin)
        {

            IList<IRadialBasisFunction> rbfs = new List<IRadialBasisFunction>();

            while (xmlin.ReadToTag())
            {
                if (xmlin.IsIt(PROPERTY_RBF, false))
                {
                    break;
                }
                else
                {
                    String name = xmlin.LastTag.Name;
                    IRadialBasisFunction rbf = LoadRBF(name, xmlin);
                    rbfs.Add(rbf);
                }
            }

            IRadialBasisFunction[] result = new IRadialBasisFunction[rbfs.Count];

            for (int i = 0; i < rbfs.Count; i++)
                result[i] = rbfs[i];

            return result;
        }
        /// <summary>
        /// Load the properties.
        /// </summary>
        /// <param name="xmlIn">The XML object.</param>
        private void HandleProperties(ReadXML xmlIn)
        {
            String end = xmlIn.LastTag.Name;
            while (xmlIn.ReadToTag())
            {
                if (xmlIn.IsIt(BasicNetworkPersistor.TAG_PROPERTY, true))
                {
                    String name = xmlIn.LastTag.GetAttributeValue(
                            BasicNetworkPersistor.ATTRIBUTE_NAME);

                    String value = xmlIn.ReadTextToTag();
                    this.currentNetwork.SetProperty(name, value);
                }
                if (xmlIn.IsIt(end, false))
                {
                    break;
                }
            }

        }
        private void HandleTags(ReadXML inXML)
        {
            String end = inXML.LastTag.Name;
            while (inXML.ReadToTag())
            {
                if (inXML.IsIt(BasicNetworkPersistor.TAG_TAG, true))
                {
                    String name = inXML.LastTag.GetAttributeValue(
                            BasicNetworkPersistor.ATTRIBUTE_NAME);

                    String layerStr = inXML.LastTag.GetAttributeValue(
                           BasicNetworkPersistor.ATTRIBUTE_LAYER);

                    int layerInt = int.Parse(layerStr);

                    ILayer layer = this.index2layer[layerInt];
                    this.currentNetwork.TagLayer(name, layer);
                    inXML.ReadToTag();
                }
                if (inXML.IsIt(end, false))
                {
                    break;
                }
            }

        }
        /// <summary>
        /// Load the SVM network. 
        /// </summary>
        /// <param name="xmlin">Where to read it from.</param>
        /// <returns>The loaded object.</returns>
        public IEncogPersistedObject Load(ReadXML xmlin)
        {
            SVMNetwork result = null;
            int input = -1, output = -1;

            String name = xmlin.LastTag.Attributes[
                    EncogPersistedCollection.ATTRIBUTE_NAME];
            String description = xmlin.LastTag.Attributes[
                    EncogPersistedCollection.ATTRIBUTE_DESCRIPTION];

            while (xmlin.ReadToTag())
            {
                if (xmlin.IsIt(SVMNetworkPersistor.TAG_INPUT, true))
                {
                    input = int.Parse(xmlin.ReadTextToTag());
                }
                else if (xmlin.IsIt(SVMNetworkPersistor.TAG_OUTPUT, true))
                {
                    output = int.Parse(xmlin.ReadTextToTag());
                }
                else if (xmlin.IsIt(SVMNetworkPersistor.TAG_MODELS, true))
                {
                    result = new SVMNetwork(input, output, false);
                    HandleModels(xmlin, result);
                }
                else if (xmlin.IsIt(EncogPersistedCollection.TYPE_SVM, false))
                {
                    break;
                }
            }

            result.Name = name;
            result.Description = description;
            return result;
        }
        /// <summary>
        /// Load the specified Encog object from an XML reader.
        /// </summary>
        /// <param name="xmlIn">The XML reader to use.</param>
        /// <returns>The loaded object.</returns>
        public IEncogPersistedObject Load(ReadXML xmlIn)
        {
            int neuronCount = 0;
            int x = 0;
            int y = 0;
            double biasActivation = 1;
            String threshold = null;
            IActivationFunction activation = null;
            String end = xmlIn.LastTag.Name;
            String context = null;

            while (xmlIn.ReadToTag())
            {
                if (xmlIn.IsIt(BasicLayerPersistor.TAG_ACTIVATION, true))
                {
                    xmlIn.ReadToTag();
                    String type = xmlIn.LastTag.Name;
                    activation = BasicLayerPersistor.LoadActivation(type, xmlIn);
                }
                else if (xmlIn.IsIt(BasicLayerPersistor.PROPERTY_NEURONS, true))
                {
                    neuronCount = xmlIn.ReadIntToTag();
                }
                else if (xmlIn.IsIt(BasicLayerPersistor.PROPERTY_X, true))
                {
                    x = xmlIn.ReadIntToTag();
                }
                else if (xmlIn.IsIt(BasicLayerPersistor.PROPERTY_Y, true))
                {
                    y = xmlIn.ReadIntToTag();
                }
                else if (xmlIn.IsIt(BasicLayerPersistor.PROPERTY_THRESHOLD, true))
                {
                    threshold = xmlIn.ReadTextToTag();
                }
                else if (xmlIn.IsIt(PROPERTY_CONTEXT, true))
                {
                    context = xmlIn.ReadTextToTag();
                }
                else if (xmlIn.IsIt(BasicLayerPersistor.PROPERTY_BIAS_ACTIVATION, true))
                {
                    biasActivation = double.Parse(xmlIn.ReadTextToTag());
                }
                else if (xmlIn.IsIt(end, false))
                {
                    break;
                }
            }

            if (neuronCount > 0)
            {
                ContextLayer layer;

                if (threshold == null)
                {
                    layer = new ContextLayer(activation, false, neuronCount);
                }
                else
                {
                    double[] t = NumberList.FromList(CSVFormat.EG_FORMAT, threshold);
                    layer = new ContextLayer(activation, true, neuronCount);
                    for (int i = 0; i < t.Length; i++)
                    {
                        layer.BiasWeights[i] = t[i];
                    }
                }

                if (context != null)
                {
                    double[] c = NumberList.FromList(CSVFormat.EG_FORMAT, context);

                    for (int i = 0; i < c.Length; i++)
                    {
                        layer.Context[i] = c[i];
                    }
                }

                layer.X = x;
                layer.Y = y;
                layer.BiasActivation = biasActivation;

                return layer;
            }
            return null;
        }
        /// <summary>
        /// Load the models. 
        /// </summary>
        /// <param name="xmlin">Where to read the models from.</param>
        /// <param name="network">Where the models are read into.</param>
        private void HandleModels(ReadXML xmlin, SVMNetwork network)
        {

            int index = 0;
            while (xmlin.ReadToTag())
            {
                if (xmlin.IsIt(SVMNetworkPersistor.TAG_MODEL, true))
                {
                    svm_parameter param = new svm_parameter();
                    svm_model model = new svm_model();
                    model.param = param;
                    network.Models[index] = model;
                    HandleModel(xmlin, network.Models[index]);
                    index++;
                }
                else if (xmlin.IsIt(SVMNetworkPersistor.TAG_MODELS, false))
                {
                    break;
                }
            }

        }
 /// <summary>
 /// Handle loading the items.
 /// </summary>
 /// <param name="xmlin">The XML input object.</param>
 public void HandleItems(ReadXML xmlin)
 {
     while (xmlin.ReadToTag())
     {
         if (xmlin.IsIt(TrainingContinuationPersistor.TAG_ITEM, true))
         {
             HandleItem(xmlin);
         }
         else if (xmlin.IsIt(TrainingContinuationPersistor.TAG_ITEM, false))
         {
             break;
         }
     }
 }
 /// <summary>
 /// Handle a model. 
 /// </summary>
 /// <param name="xmlin">Where to read the model from.</param>
 /// <param name="model">Where to load the model into.</param>
 private void HandleModel(ReadXML xmlin, svm_model model)
 {
     while (xmlin.ReadToTag())
     {
         if (xmlin.IsIt(SVMNetworkPersistor.TAG_TYPE_SVM, true))
         {
             int i = EngineArray.FindStringInArray(
                     SVMNetworkPersistor.svm_type_table, xmlin.ReadTextToTag());
             model.param.svm_type = i;
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_DEGREE, true))
         {
             model.param.degree = int.Parse(xmlin.ReadTextToTag());
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_GAMMA, true))
         {
             model.param.gamma = double.Parse(xmlin.ReadTextToTag());
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_COEF0, true))
         {
             model.param.coef0 = double.Parse(xmlin.ReadTextToTag());
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_NUMCLASS, true))
         {
             model.nr_class = int.Parse(xmlin.ReadTextToTag());
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_TOTALSV, true))
         {
             model.l = int.Parse(xmlin.ReadTextToTag());
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_RHO, true))
         {
             int n = model.nr_class * (model.nr_class - 1) / 2;
             model.rho = new double[n];
             String[] st = xmlin.ReadTextToTag().Split(',');
             for (int i = 0; i < n; i++)
                 model.rho[i] = double.Parse(st[i]);
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_LABEL, true))
         {
             int n = model.nr_class;
             model.label = new int[n];
             String[] st = xmlin.ReadTextToTag().Split(',');
             for (int i = 0; i < n; i++)
                 model.label[i] = int.Parse(st[i]);
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_PROB_A, true))
         {
             int n = model.nr_class * (model.nr_class - 1) / 2;
             model.probA = new double[n];
             String[] st = xmlin.ReadTextToTag().Split(',');
             for (int i = 0; i < n; i++)
                 model.probA[i] = Double.Parse(st[i]);
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_PROB_B, true))
         {
             int n = model.nr_class * (model.nr_class - 1) / 2;
             model.probB = new double[n];
             String[] st = xmlin.ReadTextToTag().Split(',');
             for (int i = 0; i < n; i++)
                 model.probB[i] = Double.Parse(st[i]);
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_NSV, true))
         {
             int n = model.nr_class;
             model.nSV = new int[n];
             String[] st = xmlin.ReadTextToTag().Split(',');
             for (int i = 0; i < n; i++)
                 model.nSV[i] = int.Parse(st[i]);
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_TYPE_KERNEL, true))
         {
             int i = EngineArray.FindStringInArray(
                     SVMNetworkPersistor.kernel_type_table, xmlin
                             .ReadTextToTag());
             model.param.kernel_type = i;
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_DATA, true))
         {
             HandleData(xmlin, model);
         }
         else if (xmlin.IsIt(SVMNetworkPersistor.TAG_MODEL, false))
         {
             break;
         }
     }
 }