Classes that are used as decision parents in the approximate decision strategies
(i.e., they use Nearest Neighbor querying to compute optimal decisions) must
implement the Distance trait. This is so that the distance between two parent values
can be easily computed.
For the built in classes Double, Int and Boolean, implicit conversions to Distance
are already provided, and the user does not need to do anything. The default also
handles two tuple parents of the same base type using the L2 distance
For any user defined types as a parent, they must implement the Distance trait,
and define the function distance(that:T) which defines how to compute the distance
between two instances of the class. If a user uses any combination of tuples other
than 2-tuples of Int, Boolean or Double, they must define the tuple distance as well.
See TupleDistance2 below for an example.
Trait Distance
Classes that are used as decision parents in the approximate decision strategies (i.e., they use Nearest Neighbor querying to compute optimal decisions) must implement the Distance trait. This is so that the distance between two parent values can be easily computed.
For the built in classes Double, Int and Boolean, implicit conversions to Distance are already provided, and the user does not need to do anything. The default also handles two tuple parents of the same base type using the L2 distance
For any user defined types as a parent, they must implement the Distance trait, and define the function distance(that:T) which defines how to compute the distance between two instances of the class. If a user uses any combination of tuples other than 2-tuples of Int, Boolean or Double, they must define the tuple distance as well. See TupleDistance2 below for an example.