Пример #1
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);
            }
Пример #2
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);
            }
Пример #3
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[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 <= 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);
                }
            }
Пример #4
0
            /*************************************************************************
            Serialization: Integer array
            *************************************************************************/
            public static void serializeintegerarray(alglib.serializer s,
                int[] v,
                int n) {
                int i = 0;

                if(n < 0) {
                    n = ap.len(v);
                }
                s.serialize_int(n);
                for(i = 0; i <= n - 1; i++) {
                    s.serialize_int(v[i]);
                }
            }
Пример #5
0
            /*************************************************************************
            Serialization: complex value
            *************************************************************************/
            public static void serializerealarray(alglib.serializer s,
                double[] v,
                int n) {
                int i = 0;

                if(n < 0) {
                    n = ap.len(v);
                }
                s.serialize_int(n);
                for(i = 0; i <= n - 1; i++) {
                    s.serialize_double(v[i]);
                }
            }
Пример #6
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 = ap.rows(v);
                }
                if(n1 < 0) {
                    n1 = 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]);
                    }
                }
            }