Sum by cols and rows training sample