public class DiscretizingStateHashFactory extends java.lang.Object implements StateHashFactory
addFloorDiscretizingMultipleFor(String, double)
method. When a continuous attribute is to be
hashed or compared, it is first checked if there has been a specific multiple value set for it. If so, that multiple is used for discretization. If not,
the default multiple is used. By defualt, the default multiple is 1.0 (integer floor discretization), but the default multiple may also be set
using the setDefaultFloorDiscretizingMultiple(double)
method.Modifier and Type | Class and Description |
---|---|
class |
DiscretizingStateHashFactory.DiscretizedStateHashTuple
The StateHashTuple that is generated by objects of the
DiscretizingStateHashFactory class. |
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.String,java.lang.Double> |
attributeWiseMultiples
The multiples to use for specific attributes
|
protected double |
defaultMultiple
The default multiple to use for any continuous attributes that have not been specifically set.
|
Constructor and Description |
---|
DiscretizingStateHashFactory()
Initializes.
|
DiscretizingStateHashFactory(double defaultMultiple)
Initializes with a specified default multiple to use for discretization.
|
Modifier and Type | Method and Description |
---|---|
void |
addFloorDiscretizingMultipleFor(java.lang.String attributeName,
double nearestMultipleValue)
Sets the multiple to use for discretization for the attribute with the specified name.
|
StateHashTuple |
hashState(State s) |
protected static int |
intMultiples(double mult,
double num)
Returns int result of num / mult; that is, (int)(num / mult).
|
void |
setDefaultFloorDiscretizingMultiple(double defaultMultiple)
Sets the default multiple to use for continuous attributes that do not have specific multiples set
for them.
|
protected java.util.Map<java.lang.String,java.lang.Double> attributeWiseMultiples
protected double defaultMultiple
public DiscretizingStateHashFactory()
public DiscretizingStateHashFactory(double defaultMultiple)
defaultMultiple
- the default multiple to be used by discretization.public void addFloorDiscretizingMultipleFor(java.lang.String attributeName, double nearestMultipleValue)
attributeName
- the name of the attribute whose discretization multiple is being set.nearestMultipleValue
- the multiple to which values are floored.public void setDefaultFloorDiscretizingMultiple(double defaultMultiple)
defaultMultiple
- the default multiple to which values are flooredpublic StateHashTuple hashState(State s)
hashState
in interface StateHashFactory
protected static int intMultiples(double mult, double num)
mult
- the multiplenum
- the number