Skip to content

Instantly share code, notes, and snippets.

@Shoeboxam
Shoeboxam / nn_example.m
Last active February 7, 2017 20:32
Functional erf minimization with scalar theta
environment = [4, 5, 7, 8];
expectation = 23;
% Initial weight
theta = 0.5;
theta_old = theta - 0.25;
while abs(theta - theta_old) > 1e-12
% Derivative of squared error: ln = (expectation - reinforcement)^2
dln_dr = -2 * (expectation - theta * environment);