Skip to content

Instantly share code, notes, and snippets.

@leconteur
Created August 5, 2015 18:14
Show Gist options
  • Save leconteur/6940d33bf79a1b20600f to your computer and use it in GitHub Desktop.
Save leconteur/6940d33bf79a1b20600f to your computer and use it in GitHub Desktop.
linear = MLP([Identity(), Identity()], [2, 10, 2], weights_init=Constant(1), biases_init=Constant(2))
x = tensor.matrix('x')
y_hat = linear.apply(x)
cost = ....
cg = ComputationGraph(y)
weights = VariableFilter(roles=[WEIGHTS])(cg.variables)
cg = apply_dropout(cg, weights, 0.5)
target_cost = cg.outputs[0]
algorithm = GradientDescent(cost=target_cost, params=cg.parameters,...)
extensions = [..., DataStreamMonitor([cost],..]
main_loop = MainLoop(algorithm, ..., model=linear, extensions=extensions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment