Learning Patterns with Kernels and Learning Kernels From Patterns