コード例 #1
0
ファイル: networks.py プロジェクト: herbertchen1/SciTail
    def __init__(self, hidden_neurons=100, activation_func='tanh', *args,
            **kwargs):
        super(SLmNce, self).__init__(*args, **kwargs)
        self.name = 'slm'
        self.activation_func = activation_func
        self.hidden_neurons = hidden_neurons
        self.updatable_parameters.extend(['W1', 'W2'])

        rand_values = random_value_GloBen10(
                (self.context_size * self.emb_size + 1, self.hidden_neurons),
                floatX, np.random.RandomState(7816))
        self.W1 = theano.shared(value=rand_values, name='W')
        rand_values = random_value_GloBen10(
                (self.hidden_neurons + 1, self.emb_size),
                floatX, np.random.RandomState(7817))
        self.W2 = theano.shared(value=rand_values, name='W')
コード例 #2
0
ファイル: networks.py プロジェクト: herbertchen1/SciTail
    def __init__(self, *args, **kwargs):
        super(VLblNce, self).__init__(*args, **kwargs)

        self.regularize.append('C')

        rand_values = random_value_GloBen10((self.context_size, self.emb_size),
                floatX, np.random.RandomState(2341),
                (self.context_size * self.emb_size, self.emb_size))
        self.C = theano.shared(value=rand_values, name='C')
コード例 #3
0
ファイル: networks.py プロジェクト: herbertchen1/SciTail
    def __init__(self, *args, **kwargs):
        super(LblNce, self).__init__(*args, **kwargs)
        self.name = 'lbl'
        self.updatable_parameters.append('W')
        self.regularize.append('W')

        rand_values = random_value_GloBen10(
                (self.context_size * self.emb_size, self.emb_size),
                floatX, np.random.RandomState(7816))
        self.W = theano.shared(value=rand_values, name='W')
コード例 #4
0
    def __init__(self,
                 hidden_neurons=100,
                 activation_func='tanh',
                 *args,
                 **kwargs):
        super(SLmNce, self).__init__(*args, **kwargs)
        self.name = 'slm'
        self.activation_func = activation_func
        self.hidden_neurons = hidden_neurons
        self.updatable_parameters.extend(['W1', 'W2'])

        rand_values = random_value_GloBen10(
            (self.context_size * self.emb_size + 1, self.hidden_neurons),
            floatX, np.random.RandomState(7816))
        self.W1 = theano.shared(value=rand_values, name='W')
        rand_values = random_value_GloBen10(
            (self.hidden_neurons + 1, self.emb_size), floatX,
            np.random.RandomState(7817))
        self.W2 = theano.shared(value=rand_values, name='W')
コード例 #5
0
    def __init__(self, *args, **kwargs):
        super(LblNce, self).__init__(*args, **kwargs)
        self.name = 'lbl'
        self.updatable_parameters.append('W')
        self.regularize.append('W')

        rand_values = random_value_GloBen10(
            (self.context_size * self.emb_size, self.emb_size), floatX,
            np.random.RandomState(7816))
        self.W = theano.shared(value=rand_values, name='W')
コード例 #6
0
    def __init__(self, *args, **kwargs):
        super(VLblNce, self).__init__(*args, **kwargs)

        self.regularize.append('C')

        rand_values = random_value_GloBen10(
            (self.context_size, self.emb_size), floatX,
            np.random.RandomState(2341),
            (self.context_size * self.emb_size, self.emb_size))
        self.C = theano.shared(value=rand_values, name='C')
コード例 #7
0
ファイル: layers.py プロジェクト: joluychen/THUCC
    def __init__(self,
                 name='HiddenLayer',
                 shape=(0, 0),
                 w_values=None,
                 activation=T.tanh):

        super(HiddenLayer, self).__init__(name)
        self.activation = activation

        if w_values is None:
            input_dim, output_dim, = shape
            w_values = random_value_GloBen10((input_dim, output_dim), floatX)
        if activation == theano.tensor.nnet.sigmoid:
            w_values *= 4

        self.fan_in = w_values.shape[0]
        self.clipping = False
        self.threshold = 1e12
        self.weights = theano.shared(value=w_values,
                                     name='weights_' + self.name)