Issue is in the last line. error is Tensor not callable.
Unable to write the greater than comparison part, need help on this. Is there any example in the TF documentations or the ungraded labs, I checked everywhere and could not find one.
Following confusion:
- what to type cast and what not in traffic_volume and its mean
- How to write traffic_volume for a row ??
traffic_volume
is a column in inputs
. You want to perform 2 operations:
- Calculate mean of
traffic_volume
column.
- For each row of
traffic_volume
, if it’s greater than the mean value calculated in the previous step, map the boolean value True
to 1 else 0.
Here’s the documentation for tf.greater
I am sorry I still have the same Qs.
I have understood the 2 points mentioned, but my doubts are still:
- to typecast both of these values or not?
*How to write traffic_volume for a row ??
When you perform an operation where one side is a scalar and other side is an nd-array, the operation is broadcast to all entries. Here’s an example where 1
is added to all entries of a vector and a new tensor is returned:
>>> vec = tf.constant([1,2,3,4,5])
>>> vec + 1
<tf.Tensor: shape=(5,), dtype=int32, numpy=array([2, 3, 4, 5, 6], dtype=int32)>
Assume that traffic_volume = [1,2,3,4,5]
. There are 5 rows worth data here.
- Mean of
traffic_value
is 3
.
- Use
tf.greater
to create a result of the form [False, False, False, True, True]
by comparing each entry of traffic_volume
with the mean
value.
- Integer encode the result to produce
[0, 0, 0, 1, 1]
2 Likes