def __init__(self, in_size, out_size): PredictorModel.__init__(self) self.input=T.zmatrix('X') self.y = T.zmatrix('y') # Init weights self.W = theano.shared(value=numpy.zeros((in_size, out_size), dtype=numpy.complex128), name='W', borrow=True) # Init bias self.b = theano.shared(value=numpy.zeros((out_size,), dtype=numpy.complex128), name='b', borrow=True) self.y_pred = self.get_prediction(self.input) # model parameters self.params = [self.W, self.b] learning_rate = T.scalar('learning_rate') # learning rate to use self.cost = lambda: self.negative_log_likelihood() self.train_model = theano.function(inputs=[self.input,self.y,theano.Param(learning_rate, default=0.13)], outputs=self.cost(), updates=self.get_updates(learning_rate), givens={}) self.pred_input = T.vector('pred_input') self.predict = theano.function(inputs=[self.pred_input], outputs=self.get_prediction(self.pred_input))
def test_illegal(self): try: x = zmatrix() function([x], cast(x, "float64"))(np.ones((2, 3), dtype="complex128")) except TypeError: return assert 0
def make_node(self, frames, n, axis): """ compute an n-point fft of frames along given axis """ _frames = tensor.as_tensor(frames, ndim=2) _n = tensor.as_tensor(n, ndim=0) _axis = tensor.as_tensor(axis, ndim=0) if self.half and _frames.type.dtype.startswith('complex'): raise TypeError('Argument to HalfFFT must not be complex', frames) spectrogram = tensor.zmatrix() buf = generic() # The `buf` output is present for future work # when we call FFTW directly and re-use the 'plan' that FFTW creates. # In that case, buf would store a CObject encapsulating the plan. rval = Apply(self, [_frames, _n, _axis], [spectrogram, buf]) return rval
fc1 = T.maximum(T.dot(inp, weight1) ** np.sqrt(2), 0) fc2 = T.maximum(T.tan(T.dot(fc1, weight2)), 0) fc3 = T.dot(fc2, weight3) """ """ MODEL 3: """ fc1 = T.dot(T.minimum(inp, 0), weight1)**np.sqrt(2) fc2 = T.tan(T.dot(fc1, weight2)) fc3 = T.dot(fc2, weight3) return fc3 inp = T.zmatrix() output = model(inp) nn = theano.function(inputs=[inp], outputs=[output]) z = None c = None heatmap = None def graph(x_min, x_max, y_min, y_max, step, graph=True): """ graph(...) -> None Given window parameters, graphs the fractal with 30 iterations and a threshold of 0.8 """