Enhancing Training Data Attribution with Representational Optimization