There's more...

We can use the TensorFlow control ops and tensor manipulations that we covered in the first chapter to preprocess the data. For example, in the case of Boston house price, there are about 16 data rows where the MEDV is 50.0. In most probability, these data points contain missing or censored values and it would be advisable not to consider them for the training. We can remove them from the training dataset with the following code:

condition = tf.equal(data[13], tf.constant(50.0))
data = tf.where(condition, tf.zeros(NUM_FEATURES), data[:])

Here, we first define a tensor boolean condition, which will be true if MEDV is equal to 50.0. Then we use TensorFlow tf.where() Op to assign all zeros if the condition is true.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.146.173