Domain generalization for sequential data via invariant subspace recovery