Пример #1
0
 private static DoubleVector[] generateNonSeprableData(
     DoubleVector[] featureSetOriginal1, int number) throws IOException {
   DoubleVector[] featureSetOriginal = new DoubleVector[1000];
   featureSetOriginal = featureSetOriginal1.clone();
   double[] aArray = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
   int m = aArray.length;
   for (int i = featureSetOriginal.length - number; i < featureSetOriginal.length; i++) {
     DoubleVector array = new DoubleVector(51);
     for (int j = 0; j < 51; j++) {
       if (j < m) {
         if (i % 2 == 1) {
           array.setComponent(j, (-1) * (aArray[j] + Math.random() * (aArray[j])));
         } else {
           array.setComponent(j, aArray[j] + Math.random() * (aArray[j]));
         }
       } else if (j == 50) {
         array.setComponent(j, 1.0);
       } else {
         array.setComponent(j, (-1 + Math.random() * 2));
       }
     }
     featureSetOriginal[i] = array;
   }
   return featureSetOriginal;
 }
Пример #2
0
 private static DoubleVector[] generateData() throws IOException {
   DoubleVector[] featureSet = new DoubleVector[1000];
   double[] aArray = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
   int m = aArray.length;
   for (int i = 0; i < 1000; i++) {
     DoubleVector array = new DoubleVector(51);
     for (int j = 0; j < 51; j++) {
       if (j < m) {
         if (i % 2 == 0) {
           array.setComponent(j, (-1) * (aArray[j] + Math.random() * (aArray[j])));
         } else {
           array.setComponent(j, aArray[j] + Math.random() * (aArray[j]));
         }
       } else if (j == 50) {
         array.setComponent(j, 1.0);
       } else {
         array.setComponent(j, (-1 + Math.random() * 2));
       }
     }
     featureSet[i] = array;
   }
   return featureSet;
 }