Here is my code:
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt x = np.linspace(0,10,20) train_x = np.array([[i] for i in x]) train_y = np.sin(x) regressor = tf.contrib.learn.DNNRegressor(hidden_units=[10,20, 10]) regressor.fit(x = train_x, y = train_y, steps = 2000) predictions = regressor.predict(x = train_x) plt.plot(x, train_y) plt.plot(x, predictions) plt.show() It generates the following error message/warning:
/usr/bin/python3.4 /home/ttt/Dropbox/Programming/Python/Tensor_flow/one_dim_case.py /usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/array_ops.py:1197: VisibleDeprecationWarning: converting an array with ndim > 0 to an index will result in an error in the future result_shape.insert(dim, 1) Process finished with exit code 0 Could you help me to understand what is wrong?
An additional remark, with so many hidden layers and neurons and number of iterations, I really surprised with poor sin approximation.
P.S. This is a toy example to help to understand tensorflow