Example #1
0
    def __repr__(self):
        """ Representing the class object """

        if self.structure is None:
            super(NonLinearCoxPHModel, self).__repr__()
            return self.name

        else:
            S = len(self.structure)
            self.name = self.__class__.__name__
            empty = len(self.name)
            self.name += '( '
            for i, s in enumerate(self.structure):
                n = 'Layer({}): '.format(i + 1)
                activation = nn.activation_function(s['activation'],
                                                    return_text=True)
                n += 'activation = {}, '.format(s['activation'])
                n += 'num_units = {} '.format(s['num_units'])

                if i != S - 1:
                    self.name += n + '; \n'
                    self.name += empty * ' ' + '  '
                else:
                    self.name += n
            self.name += ')'
            return self.name
Example #2
0
    def __repr__(self):
        """ Representing the class object """

        if self.structure is None:
            super(NeuralMultiTaskModel, self).__repr__()
            return self.name

        else:
            S = len(self.structure)
            self.name = self.__class__.__name__
            empty = len(self.name)
            self.name += '( '
            for i, s in enumerate(self.structure):
                if isinstance(s, list):
                    for s_ in s:
                        n = 'Layer({}): '.format(i + 1)
                        activation = nn.activation_function(s_['activation'],
                                                            return_text=True)
                        n += 'activation = {}, '.format(s_['activation'])
                        if 'num_units' in s_.keys():
                            n += 'units = {} '.format(s_['num_units'])

                        if i != S - 1:
                            self.name += n + '; \n'
                            self.name += empty * ' ' + '  '
                        else:
                            self.name += n
                    self.name = self.name + ')'
                else:
                    n = 'Layer({}): '.format(i + 1)
                    activation = nn.activation_function(s['activation'],
                                                        return_text=True)
                    n += 'activation = {}, '.format(s['activation'])
                    if 'num_units' in s.keys():
                        n += 'units = {} '.format(s['num_units'])

                    if i != S - 1:
                        self.name += n + '; \n'
                        self.name += empty * ' ' + '  '
                    else:
                        self.name += n
                self.name = self.name + ')'

            return self.name