jsat.classifiers.svm
Class SupportVectorLearner
- java.lang.Object
-
- jsat.classifiers.svm.SupportVectorLearner
-
- All Implemented Interfaces:
- java.io.Serializable
public abstract class SupportVectorLearner extends java.lang.Object implements java.io.SerializableBase class for support vector style learners. This means that the learner performs batch training on a fixed set of training points using akernelto project the data into a different space. The final set of vectors used may or may not be sparse. It does not necessarily have to be a Support Vector machine.
This class provides caching mechanism to transparently provide faster kernel.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classSupportVectorLearner.CacheModeDetermines how the final kernel values are cached.
-
Constructor Summary
Constructors Constructor and Description SupportVectorLearner(KernelTrick kernel, SupportVectorLearner.CacheMode cacheMode)Creates a new Support Vector LearnerSupportVectorLearner(SupportVectorLearner toCopy)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description SupportVectorLearner.CacheModegetCacheMode()Returns the current caching mode in useintgetCacheValue()Returns the current cache valueKernelTrickgetKernel()voidsetCacheMode(SupportVectorLearner.CacheMode cacheMode)Calling this sets the method of caching that will be used.voidsetCacheSize(long N, long bytes)Sets thecache valueto one that will use the specified amount of memory.voidsetCacheValue(int cacheValue)Sets the cache value, which may be interpreted differently by different caching schemes.voidsetKernel(KernelTrick kernel)Sets the kernel trick to use
-
-
-
Constructor Detail
-
SupportVectorLearner
public SupportVectorLearner(KernelTrick kernel, SupportVectorLearner.CacheMode cacheMode)
Creates a new Support Vector Learner- Parameters:
kernel- the kernel trick to usecacheMode- the kernel caching method to use
-
SupportVectorLearner
public SupportVectorLearner(SupportVectorLearner toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
setKernel
public void setKernel(KernelTrick kernel)
Sets the kernel trick to use- Parameters:
kernel- the kernel trick to use
-
setCacheValue
public void setCacheValue(int cacheValue)
Sets the cache value, which may be interpreted differently by different caching schemes.
This is currently only used forSupportVectorLearner.CacheMode.ROWS, where the value indicates how many rows will be cached.- Parameters:
cacheValue- the cache value to be used
-
setCacheSize
public void setCacheSize(long N, long bytes)Sets thecache valueto one that will use the specified amount of memory. If the amount of memory specified is great enough, this method will automatically set thecache modetoSupportVectorLearner.CacheMode.FULL.- Parameters:
N- the number of data pointsbytes- the number of bytes of memory to make the cache
-
getCacheValue
public int getCacheValue()
Returns the current cache value- Returns:
- the current cache value
-
getCacheMode
public SupportVectorLearner.CacheMode getCacheMode()
Returns the current caching mode in use- Returns:
- the current caching mode in use
-
setCacheMode
public void setCacheMode(SupportVectorLearner.CacheMode cacheMode)
Calling this sets the method of caching that will be used.
This is called called by the implementing class to initialize and clear the caches. Calling this with the current cache mode will initialize the caches. Once training is complete, call again withnullto deinitialize the caches.- Parameters:
cacheMode-
-
getKernel
public KernelTrick getKernel()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG