Added min/max templates in __GNUC__ (macros were undefined)
First implementation of batch learning (untested)