Task-aware Similarity Learning for Event-triggered Time Series