added function to train random kernels