Example #1
0
    def test(self, data_set: NNData, order=NNData.Order.RANDOM, one_hot=0):
        """
        This function runs the testing data through the neural network.

        Args:
            data_set (NNData): Object containing the testing data
            order: Order selection to randomize data or keep sequential
            one_hot: one hot encoding label data
        """

        if data_set.y is None:
            raise EmptySetException
        else:
            print("\nTesting:")
            data_set.prime_data(NNData.Set.TEST, order)
            rmse = self.run_test_data(data_set, one_hot)
            print("Final RMSE:", rmse)
Example #2
0
    def train(self,
              data_set: NNData,
              epochs: int = 1000,
              verbosity=2,
              order=NNData.Order.RANDOM):
        """
        Runs the training data through the neural network for the given
        number of epochs.

        Args:
            data_set (NNData): Object containing the training data.
            epochs (int): number of epochs to train the data.
            verbosity: Level of print output desired
            order: Randomize, or keep data sequential.

        """
        if data_set.x is None:
            raise EmptySetException
        else:
            print("\nTraining:")

            for epoch in range(epochs):
                data_set.prime_data(NNData.Set.TRAIN, order)
                self.run_train_data(data_set, verbosity, epoch)