sjvasquez / web-traffic-forecasting

Kaggle | Web Traffic Forecasting 📈
666 stars 239 forks source link

Always uses initial_input for loop_fn #12

Open blablahaha opened 5 years ago

blablahaha commented 5 years ago

Hi,

Thanks so much for sharing your perfect work. But I was confused in the decode part:

https://github.com/sjvasquez/web-traffic-forecasting/blob/6cb4a91da94b85857ed637afb53a8d9594f7623c/cnn.py#L342-L349

In line 343, function loop_fn, always takes initial_input as the parameter current_input.

I wonder why we don't use previous prediction for loop_fn? Just likes:

def body(time, elements_finished, emit_ta, *state_queues):
    current_input = tf.cond(time == 0, initial_input, emit_ta.read(time - 1)
    (next_finished, emit_output, state_queues) = loop_fn(time, current_input, state_queues)
    ...
zxlmufc commented 4 years ago

@SmileYuhao I've got the same doubt. Have you tried other implementation (e.g., using previous prediction in loop_fn)?

blablahaha commented 4 years ago

@zxlmufc Yes, I tried another implementation, likes:

def _body(_current_time, _out_ta, *_state_queues):
    current_input = _out_ta.read(_current_time)
    next_input, updated_queues = _loop_fn(_current_time, current_input, _state_queues)
    _out_ta = _out_ta.write(_current_time + 1, next_input)

    return [_current_time + 1, _out_ta] + list(_state_queues)

But I didn't compare those two implementations. 🤣

zxlmufc commented 4 years ago

@SmileYuhao I've compared both implementation on synthetic dataset. They are having similar performance. The new one, using previous predict, performed slightly better. In case you are curious.

blablahaha commented 4 years ago

@zxlmufc Coooool, thanks so much for satisfying my curiosity!