1. A computer implemented method of generating a kernel function comprising: by a computer: inputting a training data set and a set of pre-specified base similarity functions; combining the input base similarity functions by: constructing a new space of K-instances from pairs of training instances such that the K-instances are constructed from the pre-specified similarity functions; and outputting an indication of the generated kernel function so generated.