update

should use initial parameter self.train rather than a global parameter within __main__