This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:89571e6851e0b62af9ce7df65b3dacb0aa60bddd09ee9415ac5dd9bd9c472cd4" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:396dbbbef1f5fcd9edffd3fa859d8accd724e1b17d40c53b14e96539c7e77b8e" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:029e6d75e1a5bcd05ac659251fefd2b5420dbe5f5b1aa26b34bd5472d5097e80" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
from scipy.special import expit | |
class GRBM(object): | |
def __init__(self, n_vis, n_hid, std=0.1): | |
self.std = std | |
self.W = numpy.random.normal(loc=-1./n_hid, scale=0.1, size=[n_vis + 1, n_hid + 1]) | |
def hidden_p(self, data): | |
result = expit(data.dot(self.W)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def isotonic_transform(x, y, alpha=0.001): | |
target = y + 0. | |
output = numpy.zeros(len(x)) | |
steps = 2 ** numpy.arange(int(numpy.log2(len(x)) - 1))[::-1] | |
print steps | |
for i in range(100): | |
for step in steps: | |
penalty = 2 * (target - output) | |
diffs = - (output[step:] - output[:-step]) | |
diffs = diffs.clip(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compile_fortran(source, modulename, extra_args=''): | |
import tempfile | |
import sys | |
import numpy.f2py | |
from numpy.distutils.exec_command import exec_command | |
try: | |
f = tempfile.NamedTemporaryFile(suffix='.f90') | |
f.write(source) | |
f.flush() |
OlderNewer