title: TensorFlow, predict predict X,Y location from rssi input
body: <p>I'm new in tensorflow and try to create a model that will predict the X and Y coordinates based INPUT which consists of 86 variables that determine the strength of the signal received from the 86 scans located in the building. I have 340 test data. I parsed them and put them in two .csv files. </p>
  
  <p>The first set contains the ordered signal strengths. I saved it as data.csv.
  <a href="https://i.stack.imgur.com/ryITO.png" rel="nofollow noreferrer">data.csv</a> </p>
  
  <p>The second file contains the coordinates on which the meter was at that time. I saved it as labes.csv.
  <a href="https://i.stack.imgur.com/Ni2AB.png" rel="nofollow noreferrer">labels.csv</a></p>
  
  <p>I have already created a model, but unfortunately its accuracy changes only two training steps. If I want to make tf.summary.merge_all(), this error will appear: <a href="https://i.stack.imgur.com/bwCJD.png" rel="nofollow noreferrer">Error message</a>. If I remove this line, the training goes to a successful end, but accuracy does not change except for the first two steps: 
   <a href="https://i.stack.imgur.com/hDWmh.png" rel="nofollow noreferrer">training steps</a></p>
  
  <p>Error message here: </p>
  
  <p>Nan in summary histogram for: Biases</p>
  
  <pre><code> [[Node: Biases = HistogramSummary[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Biases/tag, Bias/read)]]
  </code></pre>
  
  <p>Caused by op 'Biases', defined at:</p>
  
  <p>File "E:\Programy\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.2\visualstudio_py_launcher.py", line 78, in </p>
  
  <pre><code>vspd.debug(filename, port_num, debug_id, debug_options, run_as)
  </code></pre>
  
  <p>File "E:\Programy\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.2\visualstudio_py_debugger.py", line 2483, in debug</p>
  
  <pre><code>exec_file(file, globals_obj)
  </code></pre>
  
  <p>File "E:\Programy\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.2\visualstudio_py_util.py", line 111, in exec_file</p>
  
  <pre><code>exec_code(code, file, global_variables)
  </code></pre>
  
  <p>File "E:\Programy\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.2\visualstudio_py_util.py", line 87, in exec_code</p>
  
  <pre><code>exec(code_obj, global_variables)
  </code></pre>
  
  <p>File "C:\Users\Tesi\documents\visual studio 2015\Projects\LocationDetectionTensorflow\LocationDetectionTensorflow\LocationDetectionTensorflow.py", line 41, in </p>
  
  <pre><code>tf.summary.histogram("Biases", b)
  </code></pre>
  
  <p>File "C:\Users\Tesi\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\summary\summary.py", line 193, in histogram</p>
  
  <pre><code>tag=tag, values=values, name=scope)
  </code></pre>
  
  <p>File "C:\Users\Tesi\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\ops\gen_logging_ops.py", line 215, in _histogram_summary</p>
  
  <pre><code>"HistogramSummary", tag=tag, values=values, name=name)
  </code></pre>
  
  <p>File "C:\Users\Tesi\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper</p>
  
  <pre><code>op_def=op_def)
  </code></pre>
  
  <p>File "C:\Users\Tesi\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 3160, in create_op</p>
  
  <pre><code>op_def=op_def)
  </code></pre>
  
  <p>File "C:\Users\Tesi\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\ops.py", line 1625, in <strong>init</strong></p>
  
  <pre><code>self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access
  </code></pre>
  
  <p>InvalidArgumentError (see above for traceback): Nan in summary histogram for: Biases</p>
  
  <pre><code> [[Node: Biases = HistogramSummary[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Biases/tag, Bias/read)]]
  </code></pre>
  
  <p>Data.csv here:</p>
  
  <p>100,94,99,100,100,100,100,100,100,100,100,100,100,100,100,90,79,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,85,100,78,77,79,78,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,89</p>
  
  <p>100,100,100,100,100,87,100,87,100,97,100,90,90,100,100,100,100,100,100,92,100,100,100,100,95,100,100,100,100,88,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,64,64,74,74,100,100,100,100,100,100,100,73,100,100,100,100,100,100,88,100,100,100,100,100,100,100,100,100,100,100,100...</p>
  
  <p>Labels.csv here:</p>
  
  <p>450,2300</p>
  
  <p>1750,900
  ...</p>
  
  <p>Code here:</p>
  
  <pre><code>import tensorflow as tf
  import numpy as np
  
  data = np.genfromtxt("dataExcel.csv", delimiter=';')
  labels = np.genfromtxt("labelsExcel.csv", delimiter=';')
  
  inputs = 86
  outputs = 2
  
  x = tf.placeholder(tf.float32, shape=[None, inputs], name='input_X')
  y = tf.placeholder(tf.float32, shape=[None, outputs], name='output_Y')
  tf.summary.histogram("input_X",x)
  tf.summary.histogram("output_Y",y)
  
  W = tf.Variable(tf.zeros([86, 2]), name="Weight")
  b = tf.Variable(tf.zeros([2]), name="Bias")
  tf.summary.histogram("Weights", W)
  tf.summary.histogram("Biases", b)
  
  with tf.name_scope("softmax") as scope:
      softmax = tf.nn.softmax(tf.matmul(x, W) + b)
  
  with tf.name_scope("cross_entropy_also_cost_function") as scope:
      cross_entropy = -tf.reduce_sum(y*tf.log(softmax))
      tf.summary.scalar("cross_entropy", cross_entropy)
  
  with tf.name_scope("train") as scope:
      optimizer = tf.train.GradientDescentOptimizer(0.01).minimize(cross_entropy)
  
  with tf.name_scope("accuracy"):
      prediction = tf.equal(tf.argmax(softmax,1),tf.argmax(y,1))
      accuracy = tf.reduce_mean(tf.cast(prediction,tf.float32))
      tf.summary.scalar("accuracy", accuracy)
  
  merged_summary = tf.summary.merge_all()
  init = tf.global_variables_initializer()
  with tf.Session() as sess:
      sess.run(init)
      avg_cost = 0.
      writer = tf.summary.FileWriter("/tmp/Location")
      writer.add_graph(sess.graph)
      for i in range(1001):
          sess.run(optimizer, feed_dict={x: train_batch_x, y: train_batch_y})
          avg_cost += sess.run(cross_entropy, feed_dict={x: train_batch_x, y: train_batch_y})
          tf.summary.scalar("avrage cost", avg_cost)
          merged_summary_string = sess.run(merged_summary, feed_dict={x: train_batch_x, y: train_batch_y})
          writer.add_summary(merged_summary_string, i)
          train_accuracy = sess.run(accuracy, feed_dict={x: train_batch_x, y: train_batch_y})
          print("STEP:", i,"=&gt;", train_accuracy,"% accuracy.")
          writer.close()
  </code></pre>
  
  <p>So my question is: how can I fix my model to predict X and Y coordinates? </p>
  
  <p>Thank you for every advice or at least effort! Have a nice day!</p>
  
  <p>Update: 
  So i should replace my sotfmax function: </p>
  
  <pre><code>with tf.name_scope("softmax") as scope:
      softmax = tf.nn.softmax(tf.matmul(x, W) + b)
  </code></pre>
  
  <p>with this?:</p>
  
  <pre><code>with tf.name_scope("softmax") as scope:
      softmax = tf.nn.softmax_cross_entropy_with_logits()'
  </code></pre>
  
  <p>But what is the input into this function? </p>