Since regression and classification are very similar, it would be better to put that code in a shared library.