modified to add relative squared losser and to have train all