Text this: Statistical quality control: a loss minimization approach