Modifying sparse coding to model imbalanced datasets