def _k(self, i1, i2):
        # for test samples,use Kernel function
        if isinstance(i2, np.ndarray):
            return self.Kernel(self.samples[i1], i2)
        # for train samples,Kernel values have been saved in matrix
        else:
            return self._K_matrix[i1, i2]