Exemplo n.º 1
0
            /*************************************************************************
            Serializer: serialization

              -- ALGLIB --
                 Copyright 14.03.2011 by Bochkanov Sergey
            *************************************************************************/
            public static void dfserialize(alglib.serializer s,
                decisionforest forest)
            {
                s.serialize_int(scodes.getrdfserializationcode());
                s.serialize_int(dffirstversion);
                s.serialize_int(forest.nvars);
                s.serialize_int(forest.nclasses);
                s.serialize_int(forest.ntrees);
                s.serialize_int(forest.bufsize);
                apserv.serializerealarray(s, forest.trees, forest.bufsize);
            }
Exemplo n.º 2
0
            /*************************************************************************
            Serializer: serialization

              -- ALGLIB --
                 Copyright 14.03.2011 by Bochkanov Sergey
            *************************************************************************/
            public static void mlpserialize(alglib.serializer s,
                multilayerperceptron network)
            {
                int i = 0;
                int j = 0;
                int k = 0;
                int fkind = 0;
                double threshold = 0;
                double v0 = 0;
                double v1 = 0;
                int nin = 0;
                int nout = 0;

                nin = network.hllayersizes[0];
                nout = network.hllayersizes[alglib.ap.len(network.hllayersizes) - 1];
                s.serialize_int(scodes.getmlpserializationcode());
                s.serialize_int(mlpfirstversion);
                s.serialize_bool(mlpissoftmax(network));
                apserv.serializeintegerarray(s, network.hllayersizes, -1);
                for (i = 1; i <= alglib.ap.len(network.hllayersizes) - 1; i++)
                {
                    for (j = 0; j <= network.hllayersizes[i] - 1; j++)
                    {
                        mlpgetneuroninfo(network, i, j, ref fkind, ref threshold);
                        s.serialize_int(fkind);
                        s.serialize_double(threshold);
                        for (k = 0; k <= network.hllayersizes[i - 1] - 1; k++)
                        {
                            s.serialize_double(mlpgetweight(network, i - 1, k, i, j));
                        }
                    }
                }
                for (j = 0; j <= nin - 1; j++)
                {
                    mlpgetinputscaling(network, j, ref v0, ref v1);
                    s.serialize_double(v0);
                    s.serialize_double(v1);
                }
                for (j = 0; j <= nout - 1; j++)
                {
                    mlpgetoutputscaling(network, j, ref v0, ref v1);
                    s.serialize_double(v0);
                    s.serialize_double(v1);
                }
            }
Exemplo n.º 3
0
            /*************************************************************************
            Serializer: serialization

              -- ALGLIB --
                 Copyright 14.03.2011 by Bochkanov Sergey
            *************************************************************************/
            public static void mlpeserialize(alglib.serializer s,
                mlpensemble ensemble)
            {
                s.serialize_int(scodes.getmlpeserializationcode());
                s.serialize_int(mlpefirstversion);
                s.serialize_int(ensemble.ensemblesize);
                apserv.serializerealarray(s, ensemble.weights, -1);
                apserv.serializerealarray(s, ensemble.columnmeans, -1);
                apserv.serializerealarray(s, ensemble.columnsigmas, -1);
                mlpbase.mlpserialize(s, ensemble.network);
            }
Exemplo n.º 4
0
            /*************************************************************************
            Serializer: serialization

              -- ALGLIB --
                 Copyright 14.03.2011 by Bochkanov Sergey
            *************************************************************************/
            public static void kdtreeserialize(alglib.serializer s,
                kdtree tree)
            {

                //
                // Header
                //
                s.serialize_int(scodes.getkdtreeserializationcode());
                s.serialize_int(kdtreefirstversion);

                //
                // Data
                //
                s.serialize_int(tree.n);
                s.serialize_int(tree.nx);
                s.serialize_int(tree.ny);
                s.serialize_int(tree.normtype);
                apserv.serializerealmatrix(s, tree.xy, -1, -1);
                apserv.serializeintegerarray(s, tree.tags, -1);
                apserv.serializerealarray(s, tree.boxmin, -1);
                apserv.serializerealarray(s, tree.boxmax, -1);
                apserv.serializeintegerarray(s, tree.nodes, -1);
                apserv.serializerealarray(s, tree.splits, -1);
            }
Exemplo n.º 5
0
            /*************************************************************************
            Serialization: complex value
            *************************************************************************/
            public static void serializerealmatrix(alglib.serializer s,
                double[,] v,
                int n0,
                int n1)
            {
                int i = 0;
                int j = 0;

                if (n0 < 0)
                {
                    n0 = alglib.ap.rows(v);
                }
                if (n1 < 0)
                {
                    n1 = alglib.ap.cols(v);
                }
                s.serialize_int(n0);
                s.serialize_int(n1);
                for (i = 0; i <= n0 - 1; i++)
                {
                    for (j = 0; j <= n1 - 1; j++)
                    {
                        s.serialize_double(v[i, j]);
                    }
                }
            }
Exemplo n.º 6
0
            /*************************************************************************
            Serialization: Integer array
            *************************************************************************/
            public static void serializeintegerarray(alglib.serializer s,
                int[] v,
                int n)
            {
                int i = 0;

                if (n < 0)
                {
                    n = alglib.ap.len(v);
                }
                s.serialize_int(n);
                for (i = 0; i <= n - 1; i++)
                {
                    s.serialize_int(v[i]);
                }
            }
Exemplo n.º 7
0
            /*************************************************************************
            Serialization: complex value
            *************************************************************************/
            public static void serializerealarray(alglib.serializer s,
                double[] v,
                int n)
            {
                int i = 0;

                if (n < 0)
                {
                    n = alglib.ap.len(v);
                }
                s.serialize_int(n);
                for (i = 0; i <= n - 1; i++)
                {
                    s.serialize_double(v[i]);
                }
            }
Exemplo n.º 8
0
            /*************************************************************************
            Serializer: serialization

              -- ALGLIB --
                 Copyright 02.02.2012 by Bochkanov Sergey
            *************************************************************************/
            public static void rbfserialize(alglib.serializer s,
                rbfmodel model)
            {

                //
                // Header
                //
                s.serialize_int(scodes.getrbfserializationcode());
                s.serialize_int(rbffirstversion);

                //
                // Data
                //
                s.serialize_int(model.nx);
                s.serialize_int(model.ny);
                s.serialize_int(model.nc);
                s.serialize_int(model.nl);
                nearestneighbor.kdtreeserialize(s, model.tree);
                apserv.serializerealmatrix(s, model.xc, -1, -1);
                apserv.serializerealmatrix(s, model.wr, -1, -1);
                s.serialize_double(model.rmax);
                apserv.serializerealmatrix(s, model.v, -1, -1);
            }