TensorFlow: Combining Categorical and Continuous Variables
Illia Polosukhin
616

Hi,

Thanks for your tutorial it is very helpful. I have a question — If I want to perform early stopping, using the same pandas_input_fn, I get the following error:

File “online_tensor1_Hotel.py”, line 306, in <module>
 classifier.fit(input_fn=pandas_input_fn(X_train.loc[0:train_base,],y_train.loc[0:train_base]), steps=2500,monitors=[validation_monitor])
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py”, line 219, in fit
 max_steps=max_steps)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py”, line 507, in _train_model
 max_steps=max_steps)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/graph_actions.py”, line 281, in _supervised_train
 None)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/supervised_session.py”, line 318, in run
 run_metadata=run_metadata)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/recoverable_session.py”, line 54, in run
 run_metadata=run_metadata)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/coordinated_session.py”, line 70, in run
 self._coord.join(self._coordinated_threads_to_join)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/python/training/coordinator.py”, line 383, in join
 six.reraise(*self._exc_info_to_raise)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/coordinated_session.py”, line 66, in run
 return self._sess.run(*args, **kwargs)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/monitored_session.py”, line 107, in run
 induce_stop = monitor.step_end(monitors_step, monitor_outputs)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/monitors.py”, line 396, in step_end
 return self.every_n_step_end(step, output)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/monitors.py”, line 696, in every_n_step_end
 steps=self.eval_steps, metrics=self.metrics, name=self.name)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py”, line 277, in evaluate
 shuffle=False, epochs=1)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py”, line 84, in _get_input_fn
 epochs=epochs)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py”, line 117, in setup_train_data_feeder
 x, y, n_classes, batch_size, shuffle=shuffle, epochs=epochs)
 File “/usr/local/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/learn_io/data_feeder.py”, line 249, in __init__
 self._x = check_array(x, dtype=x.dtype)
AttributeError: ‘function’ object has no attribute ‘dtype’

Would you have any suggestions?

Thanks,

Nitika

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.