Loading
  • Twitter
  • Mail
  • Facebook
Orbifold Consulting
  • AI
    • Natural Language Understanding
    • Knowledge Representation
    • Bots & Agents
    • Cognitive Computing
    • Probabilistic Programming
    • Recipes
  • Data Science
    • Graph Analytics
    • Time Series and Forecasting
    • Data Visualization
    • Optimization
    • Predictive Analytics
    • Recipes
  • Big Data
    • Dataiku
    • H2O
    • Hortonworks
  • Quantum Computing
    • Topological Quantum Computing
    • Quantum Cryptography
    • Categorical Quantum Computing
    • Topological Computing
  • Blog
  • Contact
  • Search
  • Menu

TensorFlow hello world

AI Recipes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    import tensorflow as tf
 
 
    import numpy as np
    x_input = np.array([[1,2,3,4,5]])
    y_input = np.array([[10]])
 
 
    x = tf.placeholder(tf.float32, [None, 5])
    y = tf.placeholder(tf.float32, [None, 1])
 
 
    W = tf.Variable(tf.zeros([5, 1]))
    b = tf.Variable(tf.zeros([1]))
    y_pred = tf.matmul(x, W)+b
 
 
    loss = tf.reduce_sum(tf.pow((y-y_pred), 2))
 
 
    train = tf.train.GradientDescentOptimizer(0.0001).minimize(loss)
 
 
    init = tf.global_variables_initializer()
 
 
    sess = tf.Session()
    sess.run(init)
    for i in range(10):
        feed_dict = {x: x_input, y: y_input}
        sess.run(train, feed_dict=feed_dict)
 
 
    sess = tf.Session()
    sess.run(init)
    for i in range(10):
        feed_dict = {x: x_input, y: y_input}
        _, loss_value = sess.run([train, loss], feed_dict=feed_dict)
        print(loss_value)
 
100.0
97.77255
95.594696
93.46538
91.38347
89.34794
87.357765
85.41191
83.5094
81.64925
 

September 1, 2018/by Orbifold
Tags: Python, TensorFlow
https://i2.wp.com/ai.orbifold.net/default/wp-content/uploads/2018/05/TensorFlowBlocks.png?fit=640%2C427 427 640 Orbifold http://ai.orbifold.net/default/wp-content/uploads/2016/11/OrbifoldNextLogo.png Orbifold2018-09-01 13:58:542018-09-02 06:21:46TensorFlow hello world
You might also like
Keras hello world
Introduction to semantics: Python
Feature selection with pipelines
Reinforced tennis
TF LinearRegression estimator
Classification with LSTM
Microsoft Concept Graph in Neo4j
Speech recognition
© Copyright 2005-2018 - Orbifold Consulting |Terms | Privacy
  • Twitter
  • Mail
  • Facebook
  • AI
  • Data Science
  • Big Data
  • Quantum Computing
  • Blog
  • Contact
Pytorch hello world Linear regression with MXNet
Scroll to top

This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.

Learn moreOK