All kernel regression methods should accept precomputed Gram matrices
#8.445 aberto em 23 de fev. de 2017
Métricas do repositório
- Stars
- (66.084 stars)
- Métricas de merge de PR
- (Mesclagem média 10d) (90 fundiu PRs em 30d)
Description
SVR has an option
kernel='precomputed'
If this is chosen, then the X array passed to the fit method is the Gram matrix of the training examples. This option should also be available for GPR and KRR.
Here is some motivation. Many machine learning projects begin by defining a feature set, and many algorithms intrinsically require a vector of real numbers for each sample. e.g. linear regression.
Kernel methods take a different approach: the modeller supplies a function, the "kernel", which measures the similarity between two samples. This need not be expressed in terms of features. For example, it is easy to say what it means for two DNA sequences to be similar, but hard to reduce a DNA sequence to a vector of features. So SVR correctly is willing to build a model with:
model = svm.SVR(kernel='precomputed')
model.fit( kernel(training.molecule), training.y.values)
(My current project is a cheminformatic one.)
It would be great if the other kernel methods supported this. At present, they require a kernel function which they pass the X values to, after checking that X is an array of floats. So some of the value of kernel methods is denied.