creating a base class to train data