public static double trainAndTestNeuralNetwork(int cycles, int numTraining, int numTesting) {
    Logic.trainNeuralNetwork(cycles, numTraining);
    { double mse = 0.0;
      Vector testingExamples = Vector.newVector(numTesting);

      { int i = Stella.NULL_INTEGER;
        int iter000 = numTraining;
        int upperBound000 = numTraining + (numTesting - 1);

        for (;iter000 <= upperBound000; iter000 = iter000 + 1) {
          i = iter000;
          (testingExamples.theArray)[(i - numTraining)] = (((TrainingExample)(Logic.$TRAINING_EXAMPLES$.nth(i))));
        }
      }
      { TrainingExample example = null;
        Vector vector000 = testingExamples;
        int index000 = 0;
        int length000 = vector000.length();

        for (;index000 < length000; index000 = index000 + 1) {
          example = ((TrainingExample)((vector000.theArray)[index000]));
          if (!(example.module == null)) {
            example.module.changeModule();
          }
          { Cons form = ((Cons)(Stella_Object.copyConsTree(example.query)));
            QueryIterator query = Logic.makeQuery(Stella.NIL, Logic.coerceToTree(form), Stella.NIL, Stella.NIL);
            double output = QueryIterator.returnPartialTruth(query, true);
            double error = example.score - output;

            mse = mse + (error * error);
          }
        }
      }
      mse = mse / numTesting;
      return (mse);
    }
  }