Exemplo n.º 1
0
    def __init__(self,train_data, hyper):
        """
    Constructor

    ------------

    train_data: pandas DataFrame
                Contains columns for features and for target variables. The names of the target variables ends
                with the suffix "_tau"
    hyper:      dictionary
                It contains the hyper parameters necessary to run all the functionality of the model.
                They are the following:
                "structure" is a list of integers determining the number of neurons in each hidden layer.
                "epochs" an integer specifying the maximum number of epochs to run during every training session.
                "learning_rate" a float giving the learning rate of the gradient descend.
                "momentum" a float giving the value of the momentum for the algorithm.
                Other parameters regarding cross validation are explained in the base class.

        """
        Regression.__init__(self, train_data, hyper)

        self.structure = self._build_structure(hyper['structure'])

        self.epochs = hyper['epochs']
        self.learning_rate = hyper['learning_rate']
        self.momentum = hyper['momentum']
        self.path_train = hyper['path_train']
        self.path_test = hyper['path_test']
        self.path_model = hyper['path_model']
        self.path_output = hyper['path_output']
Exemplo n.º 2
0
    def __init__(self, train_data, hyper):
        """
    Constructor

    ------------

    train_data: pandas DataFrame
                Contains columns for features and for target variables. The names of the target variables ends
                with the suffix "_tau"
    hyper:      dictionary
                It contains the hyper parameters necessary to run all the functionality of the model.
                They are the following:
                "structure" is a list of integers determining the number of neurons in each hidden layer.
                "epochs" an integer specifying the maximum number of epochs to run during every training session.
                "learning_rate" a float giving the learning rate of the gradient descend.
                "momentum" a float giving the value of the momentum for the algorithm.
                Other parameters regarding cross validation are explained in the base class.

        """
        Regression.__init__(self, train_data, hyper)

        self.structure = self._build_structure(hyper['structure'])

        self.epochs = hyper['epochs']
        self.learning_rate = hyper['learning_rate']
        self.momentum = hyper['momentum']
        self.path_train = hyper['path_train']
        self.path_test = hyper['path_test']
        self.path_model = hyper['path_model']
        self.path_output = hyper['path_output']
Exemplo n.º 3
0
    def __init__(self, train_data, hyper,  n_targets=None, label_targets=None):
        """
    ------------

    train_data: pandas DataFrame
                Contains columns for features and for target variables. The names of the target variables ends
                with the suffix "_tau"
    hyper:      dictionary
                It contains the hyperparameters necessary to run all the functionalities of the model.
                 They are the following:
                "structure" is a list of integers determining the number of neurons in each hidden layer
                "epochs" an integer specifying the maximum number of epochs to run during every training session
                "learning_rate" a float giving the learning rate of the gradient descend
                "momentum" a float giving the value of the momentum for the algorithm
                "batch" a bool. If True the method performs full batch learning, i.e. updates of the weights is done
                using all the instances of the training set. Else, normal online method is performed
                Other parameters regarding cross validation are explained in the base class

        """
        Regression.__init__(self, train_data, hyper, n_targets=n_targets, label_targets=label_targets)

        self.N = FeedForwardNetwork()
        self.structure = [self.n_feature] + hyper['structure'] + [self.n_target]

        self._build_net(self.structure)
        self.res_params = [self.N.params[i] for i in range(len(self.N.params))]

        self.train_fraction = hyper['train_fraction']
        self.seed = hyper['seed']
        self.epochs = hyper['epochs']
        self.learning_rate = hyper['learning_rate']
        self.momentum = hyper['momentum']
        self.batch = bool(hyper['batch'])