Fig 8 -Code segment to train the model