jsat.parameters
Class Parameter
- java.lang.Object
-
- jsat.parameters.Parameter
-
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- BooleanParameter, DoubleParameter, IntParameter, MetricParameter, ObjectParameter
public abstract class Parameter extends java.lang.Object implements java.io.SerializableThis interface provides a programmable manner in which the parameters of an algorithm may be altered and adjusted.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static interfaceParameter.ParameterHolderAdding this annotation to a field tells thegetParamsFromMethods(java.lang.Object)method to search this object recursively for more parameter get/set pairs.
Placing this annotation on aCollectionwill cause the search to be done recursively over each item in the collection.static interfaceParameter.WarmParameterAdding this annotation to a method tells thegetParamsFromMethods(java.lang.Object)method to consider the Parameter object generated for that method a preferred parameter for warm starting.
-
Constructor Summary
Constructors Constructor and Description Parameter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Object obj)abstract java.lang.StringgetASCIIName()Returns the name of this parameter using only valid ACII characters.java.lang.StringgetName()Returns the display name of this parameter.static java.util.List<Parameter>getParamsFromMethods(java.lang.Object obj)Given an object, this method will use reflection to automatically find getter and setter method pairs, and create Parameter object for each getter setter pair.
Getters are found by searching for no argument methods that start with "get" or "is".abstract java.lang.StringgetValueString()Returns a string indicating the value currently held by the ParameterinthashCode()booleanisWarmParameter()Iftrue, that means this parameter is the preferred parameter to be altered when warm starting from a previous version of the same class.booleanpreferredLowToHigh()booleanrequiresRetrain()Some variables of a learning method may be adjustable without having to re-train the whole data set.static java.util.Map<java.lang.String,Parameter>toParameterMap(java.util.List<Parameter> params)Creates a map of all possible parameter names to their corresponding object.java.lang.StringtoString()
-
-
-
Method Detail
-
requiresRetrain
public boolean requiresRetrain()
Some variables of a learning method may be adjustable without having to re-train the whole data set. false is returned if this is such a parameter, true if the learning method will need to be retrained after the parameter has changed.
By default, this method returns true unless overwritten, as it is always safe to retrain the classifier if a parameter was changed.- Returns:
- true if changing this parameter requires a re-training of the algorithm, or false if no-retraining is needed to take effect.
-
isWarmParameter
public boolean isWarmParameter()
Iftrue, that means this parameter is the preferred parameter to be altered when warm starting from a previous version of the same class. Being the preferred parameter means that using warms started training on a sequence of changes to this parameter should be faster than simply training normally for every combination of values.
If more than one parameter would have this impact on training, the one that has the largest and most consistent impact should be selected.
By default, this method will returnfalse.- Returns:
trueif warm starting on changes in this parameter has a significant impact on training speed,falseotherwise.
-
preferredLowToHigh
public boolean preferredLowToHigh()
This value is meaningless ifisWarmParameter()isfalse, and by default returnsfalse.
This should return the preferred order of warm start value training in the progression of the warm parameter, either from low values to high values (ie: the model being trained has a higher value for this parameter than the warm model being trained from).- Returns:
trueif warm starting on this parameter should occur from low values to high values, andfalseif it should go from high values to low.
-
getASCIIName
public abstract java.lang.String getASCIIName()
Returns the name of this parameter using only valid ACII characters.- Returns:
- the ACII name
-
getName
public java.lang.String getName()
Returns the display name of this parameter. By default, this returns theASCII nameof the parameter. If one exists, a name using Unicode characters may be returned instead.- Returns:
- the name of this parameter
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getValueString
public abstract java.lang.String getValueString()
Returns a string indicating the value currently held by the Parameter- Returns:
- a string representation of the parameter's value
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toParameterMap
public static java.util.Map<java.lang.String,Parameter> toParameterMap(java.util.List<Parameter> params)
Creates a map of all possible parameter names to their corresponding object. No two parameters may have the same name.- Parameters:
params- the list of parameters to create a map for- Returns:
- a map of string names to their parameters
- Throws:
java.lang.RuntimeException- if two parameters have the same name
-
getParamsFromMethods
public static java.util.List<Parameter> getParamsFromMethods(java.lang.Object obj)
Given an object, this method will use reflection to automatically find getter and setter method pairs, and create Parameter object for each getter setter pair.
Getters are found by searching for no argument methods that start with "get" or "is". Setters are found by searching for one argument methods that start with "set". A getter and setter are a pair only if everything after the prefix is the same in the method's name, and the return type of the getter is the same class as the argument for the setter.
Current types supported are:- integer
- doubles
- booleans
Kernel FunctionsDistance MetricsEnums
- Parameters:
obj-- Returns:
- a list of parameter objects generated from the given object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG