hughperkins / DeepCL

OpenCL library to train deep convolutional neural networks
Mozilla Public License 2.0
865 stars 199 forks source link

Simple example network for XOR task #76

Closed d0znpp closed 8 years ago

d0znpp commented 8 years ago

Hi! Thx for a great job!

Can I ask you to add simple Python example without images recognition? Smth like http://www.mind.ilstu.edu/curriculum/artificial_neural_net/xor_problem_and_solution.php

It would be great to understand library methods without documentation.

hughperkins commented 8 years ago

Sure. It is here :-) https://github.com/hughperkins/DeepCL/blob/master/test/testlogicaloperators.cpp#L220

TEST( testlogicaloperators, Convolve_2layers_relu_Xor ) {
cout << "Xor, convolve" << endl;
...

You can run it like this:

deepcl_unittests tests=testlogicaloperators.Convolve_2layers_relu_Xor

https://gist.github.com/hughperkins/b13f07e553dea1b742dc73b6686f367e

hughperkins commented 8 years ago

Oh. python.... hmmm... ok, let me ponder that :-)

hughperkins commented 8 years ago

How does this look? https://github.com/hughperkins/DeepCL/blob/master/python/examples/xor.py

d0znpp commented 8 years ago

Great, thx!

hughperkins commented 8 years ago

Cool :-)

hughperkins commented 8 years ago

(Hmmm, seems seed is more complicted than setting the python-side seed. Pondering...)

hughperkins commented 8 years ago

(added seed method now PyDeepCL.RandomSingleton.seed(some_seed_here) https://github.com/hughperkins/DeepCL/blob/0092b0c57c65ca91ff174e2d6d32f91a1c2c5c7a/python/examples/xor.py#L33 )