Created
September 8, 2017 13:36
-
-
Save ilyakava/c3cf725a0c250155d18ebbfe438e0c3f to your computer and use it in GitHub Desktop.
This file contains 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
// http://cs.stanford.edu/people/karpathy/convnetjs//demo/classify2d.html | |
(function xor_data(){ | |
data = []; | |
labels = []; | |
data.push([0 , 0 ]); labels.push(0); | |
data.push([1 , -1 ]); labels.push(0); | |
data.push([0 , -1 ]); labels.push(1); | |
data.push([1 , 0 ]); labels.push(1); | |
N = labels.length; | |
})() | |
// small network | |
layer_defs = []; | |
layer_defs.push({type:'input', out_sx:1, out_sy:1, out_depth:2}); | |
layer_defs.push({type:'fc', num_neurons:2, activation: 'relu'}); | |
layer_defs.push({type:'softmax', num_classes: 2}); | |
net = new convnetjs.Net(); | |
net.makeLayers(layer_defs); | |
trainer = new convnetjs.SGDTrainer(net, {learning_rate:0.05, momentum:0.1, batch_size:4, l2_decay:0.001}); | |
// inspect, index 1 | |
net.layers | |
// orig network | |
layer_defs = []; | |
layer_defs.push({type:'input', out_sx:1, out_sy:1, out_depth:2}); | |
layer_defs.push({type:'fc', num_neurons:6, activation: 'tanh'}); | |
layer_defs.push({type:'fc', num_neurons:2, activation: 'tanh'}); | |
layer_defs.push({type:'softmax', num_classes:2}); | |
net = new convnetjs.Net(); | |
net.makeLayers(layer_defs); | |
trainer = new convnetjs.SGDTrainer(net, {learning_rate:0.01, momentum:0.1, batch_size:10, l2_decay:0.001}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment