Traffic Refinery: Cost-Aware Traffic Representation for Machine Learning in Networks