Coder Social home page Coder Social logo

hellotf's Introduction

HelloTF

##Installing Tensorflow Depending on your platform, you need to install tensorflow library. The below link should help.

https://www.tensorflow.org/install/

For this basic code, you do not need GPU support. It will easily run on a CPU.

Also you need Python3.x

##Running the code python3 1_gate_learn.py

##OUTPUT: ###Code Output:

number of training examples = 4 
X_train shape: (2, 4) 
Y_train shape: (1, 4) 
0 0.594839 1.0 [[ 0.48101175  0.36990312  0.31571779  0.44649839]] 
10 0.451503 1.0 [[ 0.30754173  0.29681206  0.15319541  0.40467405]] 
20 0.394287 1.0 [[ 0.22161396  0.24571806  0.09625828  0.38950431]] 
30 0.344328 1.0 [[ 0.16325271  0.20063613  0.08151171  0.41442931]] 
40 0.294998 1.0 [[ 0.10710264  0.16709907  0.05555663  0.44216263]] 
50 0.254292 1.0 [[ 0.07689214  0.1468157   0.04326564  0.48218927]] 
60 0.218617 1.0 [[ 0.06239825  0.11634921  0.04796128  0.52672237]] 
70 0.18769 1.0 [[ 0.05102341  0.11169618  0.04297816  0.5802145 ]] 
80 0.159034 1.0 [[ 0.03196755  0.07987423  0.03033573  0.60754716]] 
90 0.139308 1.0 [[ 0.02612194  0.07000994  0.02878116  0.65850174]] 
100 0.123399 1.0 [[ 0.02204676  0.06331776  0.02755842  0.69188172]]

###Explained Op: After every 10 iterations, it will provide you the epoch #, log loss, accuracy, and output at the last layer. It is trained only on 4 data points. I have used logic gates inputs and output.

###Suggested modifications

Ln20: Y_train = np.matrix('0 ;0 ;0 ;1')    #try changing the gate type

You can change the values here. The above example resembles AND gate. You can try other ones.

Ln42: h = 4   

This variable specifies the number of hidden layer nodes. Try changing it and see the effect.

Ln77: optimizer = tf.train.GradientDescentOptimizer(learning_rate = 0.3).minimize(cost)  

Try changing the learning rate here. Try changing it and see the effect.

hellotf's People

Watchers

Aniket Shirsat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.