Click or drag to resize
Accord.NET (logo)

KernelFunctionCache Class

Value cache for kernel function evaluations. The total memory size occupied by the cache can fluctuate between MinimumBytes and MaximumBytes.
Inheritance Hierarchy
SystemObject
  Accord.Statistics.KernelsKernelFunctionCacheIKernel, Double
    Accord.Statistics.KernelsKernelFunctionCache

Namespace:  Accord.Statistics.Kernels
Assembly:  Accord.Statistics (in Accord.Statistics.dll) Version: 3.8.0
Syntax
public class KernelFunctionCache : KernelFunctionCache<IKernel, double[]>
Request Example View Source

The KernelFunctionCache type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyCount
Gets the current number of rows stored in this cache.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public propertyEnabled
Gets a value indicating whether the cache is enabled. If the value is false, it means the kernel function is being evaluated on-the-fly.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public propertyHits
Gets the total number of cache hits.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public propertyItemInt32
Attempts to retrieve the value of the kernel function from the diagonal of the kernel matrix. If the value is not available, it is immediately computed and inserted in the cache.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public propertyItemInt32, Int32
Attempts to retrieve the kernel function evaluated between point at index i and j. If it is not cached, it will be computed and the cache will be updated.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public propertyMaximumBytes
Gets the maximum size of the cache, measured in bytes.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public propertyMinimumBytes
Gets the minimum size of the cache, measured in bytes.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public propertyMisses
Gets the total number of cache misses.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public propertySize
Gets the size of the cache, measured in number of rows.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public propertyUsage
Gets the percentage of the cache currently in use.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Top
Methods
  NameDescription
Public methodClear
Clears the cache.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public methodDispose
Disposes this instance.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Protected methodDispose(Boolean)
Releases unmanaged and - optionally - managed resources.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetDataCache
Gets a copy of the data cache.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetKeyFromIndex
Gets the key from the given indices.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public methodGetLeastRecentlyUsedList
Gets a copy of the Least Recently Used (LRU) List of Kernel Matrix elements. Elements on the start of the list have been used most; elements at the end are about to be discarded from the cache.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public methodStatic memberGetNumberOfRowsForMaximumSizeInBytes
Gets the maximum number of rows that a cache can keep inside the given amount of bytes. This value can be used to initialize SequentialMinimalOptimization's CacheSize property, or be passed to KernelFunctionCache constructor.
Public methodStatic memberGetNumberOfRowsForMaximumSizeInGigaBytes
Gets the maximum number of rows that a cache can keep inside the given amount of bytes. This value can be used to initialize SequentialMinimalOptimization's CacheSize property, or be passed to KernelFunctionCache constructor.
Public methodStatic memberGetNumberOfRowsForMaximumSizeInMegaBytes
Gets the maximum number of rows that a cache can keep inside the given amount of bytes. This value can be used to initialize SequentialMinimalOptimization's CacheSize property, or be passed to KernelFunctionCache constructor.
Public methodGetOrCompute(Int32)
Attempts to retrieve the value of the kernel function from the diagonal of the kernel matrix. If the value is not available, it is immediately computed and inserted in the cache.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public methodGetOrCompute(Int32, Int32)
Attempts to retrieve the kernel function evaluated between point at index i and j. If it is not cached, it will be computed and the cache will be updated.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodReset
Resets cache statistics.
(Inherited from KernelFunctionCacheTKernel, TInput.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

This class works as a least-recently-used cache for elements computed from a the kernel (Gram) matrix. Elements which have not been needed for some time are discarded from the cache; while elements which are constantly requested remains cached.

The use of cache may speedup learning by a large factor; however the actual speedup may vary according to the choice of cache size.

The total memory size occupied by the cache can fluctuate between MinimumBytes and MaximumBytes.

See Also