added a function to train over similarity