Kernel which caches all data to avoid duplicate computation
This kernel is very useful for any analysis which will retrain or repredict the same data multiple times, as this kernel will avoid recalculating the kernel function. Examples of such analyses include cross validation, bootstrapping, and model selection (assuming the kernel function itself does not change, e.g. when selecting for C in an SVM).
The kernel will automatically cache any new data sent through compute, and will be able to use this cache whenever a subset of this data is sent through compute again. If new (uncached) data is sent through compute, then the cache is recreated from scratch. Therefore, you should compute the kernel on the entire superset of your data before using this kernel normally (computing a new cache invalidates any previous cached data).
The cache is asymmetric for lhs and rhs, so compute(d1, d2) does not create a cache usable for compute(d2, d1).
Methods
add_conversion(typename, methodfull, methodraw) | Adds methods to the Kernel class for new conversions |
as_ls(kernel) | |
as_np() | Converts this kernel to a Numpy-based representation |
as_raw_ls(kernel) | |
as_raw_np() | Directly return this kernel as a numpy array. |
cleanup() | Wipe out internal representation |
compute(ds1[, ds2, force]) | Automatically computes and caches the kernel or extracts the |
computed(*args, **kwargs) | Compute kernel and return self |
reset() |
Initialize CachedKernel
Parameters: | kernel : Kernel
enable_ca : None or list of str
disable_ca : None or list of str
|
---|
Methods
add_conversion(typename, methodfull, methodraw) | Adds methods to the Kernel class for new conversions |
as_ls(kernel) | |
as_np() | Converts this kernel to a Numpy-based representation |
as_raw_ls(kernel) | |
as_raw_np() | Directly return this kernel as a numpy array. |
cleanup() | Wipe out internal representation |
compute(ds1[, ds2, force]) | Automatically computes and caches the kernel or extracts the |
computed(*args, **kwargs) | Compute kernel and return self |
reset() |
Automatically computes and caches the kernel or extracts the relevant part of a precached kernel into self._k
Parameters: | force : bool
|
---|