def run_with_crossvalidation(self, data, iterations=5):
        """
        This function estimates the performance of the neural network using crossvalidation using a specified dataset.
        Args:
        :param ds (TweetRegressionDatasetFactory): the dataset used to crossvalidate the network.
        :param iterations (int, optional): number of iterations for the crossvalidation.
        :returns error (float): the average percent error of the dataset, tested on the network using crossvalidation.
        """
        x = ds.DS['input']
        y = ds.DS['target']
        n, m = x.shape
        errors = np.zeros(iterations)
        cv = cross_validation.KFold(n, iterations, shuffle=True)

        i = 0
        for train_index, test_index in cv:
            x_train = x[train_index, :]
            y_train = y[train_index, :]
            x_test = x[test_index, :]
            y_test = y[test_index, :]

            ds_train = RegressionData.conv2DS(x_train, y_train)
            ds_test = RegressionData.conv2DS(x_test, y_test)

            trainer = BackpropTrainer(
                self.network,
                dataset=ds_train,
                learningrate=self.learningrate,
                momentum=self.momentum,
                verbose=self.verbose,
                batchlearning=self.batchlearning)

            trainer.trainUntilConvergence(
                dataset=ds_train,
                maxEpochs=self.max_epochs,
                continueEpochs=self.con_epochs)

            tstresult = self.test(ds_test)
            errors[i] = tstresult[0]
            i += 1

        print "Simple Regression Neural Network cross-validation test errors: " % errors
        return np.average(errors)