Example #1
0
        public static void dataSplit(dataSet X, double v1, double v2, dataSet X1, dataSet X2)
        {
            if (v2 < v1)
            {
                throw new Exception("error");
            }
            X1.Clear();
            X2.Clear();
            X1.setDataInfo(X);
            X2.setDataInfo(X);
            int n1 = (int)(X.Count * v1);
            int n2 = (int)(X.Count * v2);

            for (int i = 0; i < X.Count; i++)
            {
                if (i >= n1 && i < n2)
                {
                    X1.Add(X[i]);
                }
                else
                {
                    X2.Add(X[i]);
                }
            }
        }
Example #2
0
        public static void dataSplit(dataSet X, double v, dataSet X1, dataSet X2)
        {
            X1.Clear();
            X2.Clear();
            X1.setDataInfo(X);
            X2.setDataInfo(X);
            int n = (int)(X.Count * v);

            for (int i = 0; i < X.Count; i++)
            {
                if (i < n)
                {
                    X1.Add(X[i]);
                }
                else
                {
                    X2.Add(X[i]);
                }
            }
        }
Example #3
0
        public static void dataSizeScale(dataSet X)
        {
            dataSet XX = new dataSet();

            XX.setDataInfo(X);
            foreach (dataSeq im in X)
            {
                XX.Add(im);
            }
            X.Clear();

            int n = (int)(XX.Count * Global.trainSizeScale);

            for (int i = 0; i < n; i++)
            {
                int j = i;
                if (j > XX.Count - 1)
                {
                    j %= XX.Count - 1;
                }
                X.Add(XX[j]);
            }
            X.setDataInfo(XX);
        }