Learning Invariant Representation of Tasks for Robust Surgical State Estimation