@@ -195,58 +195,32 @@ class DNNRegressionModel(Model):
195195 make sure to take a BACKUP of files with same name in the directory
196196 from where this command is run as it overwrites any existing files.
197197
198- .. code-block:: console
199-
200- $ cat > train.csv << EOF
201- Feature1,Feature2,TARGET
202- 0.93,0.68,3.89
203- 0.24,0.42,1.75
204- 0.36,0.68,2.75
205- 0.53,0.31,2.00
206- 0.29,0.25,1.32
207- 0.29,0.52,2.14
208- EOF
209- $ cat > test.csv << EOF
210- Feature1,Feature2,TARGET
211- 0.57,0.84,3.65
212- 0.95,0.19,2.46
213- 0.23,0.15,0.93
214- EOF
215- $ dffml train \\
216- -model tfdnnr \\
217- -model-epochs 300 \\
218- -model-steps 2000 \\
219- -model-predict TARGET:float:1 \\
220- -model-hidden 8 16 8 \\
221- -sources s=csv \\
222- -source-filename train.csv \\
223- -model-features \\
224- Feature1:float:1 \\
225- Feature2:float:1 \\
226- -log debug
227- Enabling debug log shows tensorflow losses...
228- $ dffml accuracy \\
229- -model tfdnnr \\
230- -model-predict TARGET:float:1 \\
231- -model-hidden 8 16 8 \\
232- -sources s=csv \\
233- -source-filename test.csv \\
234- -model-features \\
235- Feature1:float:1 \\
236- Feature2:float:1 \\
237- -log critical
198+ .. literalinclude:: /../model/tensorflow/examples/tfdnnr/train_data.sh
199+
200+ .. literalinclude:: /../model/tensorflow/examples/tfdnnr/test_data.sh
201+
202+ Train the model
203+
204+ .. literalinclude:: /../model/tensorflow/examples/tfdnnr/train.sh
205+
206+ Assess the accuracy
207+
208+ .. literalinclude:: /../model/tensorflow/examples/tfdnnr/accuracy.sh
209+
210+ Output
211+
212+ .. code-block::
213+
238214 0.9468210011
239- $ echo -e 'Feature1,Feature2,TARGET\\ n0.21,0.18,0.84\\ n' | \\
240- dffml predict all \\
241- -model tfdnnr \\
242- -model-predict TARGET:float:1 \\
243- -model-hidden 8 16 8 \\
244- -sources s=csv \\
245- -source-filename /dev/stdin \\
246- -model-features \\
247- Feature1:float:1 \\
248- Feature2:float:1 \\
249- -log critical
215+
216+ Make a prediction
217+
218+ .. literalinclude:: /../model/tensorflow/examples/tfdnnr/predict.sh
219+
220+ Output
221+
222+ .. code-block:: json
223+
250224 [
251225 {
252226 "extra": {},
@@ -266,6 +240,10 @@ class DNNRegressionModel(Model):
266240 }
267241 ]
268242
243+ Example usage of Tensorflow DNNEstimator model using python API
244+
245+ .. literalinclude:: /../model/tensorflow/examples/tfdnnr/tfdnnr.py
246+
269247 The ``NaN`` in ``confidence`` is the expected behaviour. (See TODO in
270248 predict).
271249
0 commit comments