com.kpro.algorithm
Class bitmapDistance

java.lang.Object
  extended by com.kpro.algorithm.DistanceMetric
      extended by com.kpro.algorithm.bitmapDistance

public class bitmapDistance
extends DistanceMetric

A distance metric that calculates distance based on weighed union of a bit map interception

Version:
240911.01
Author:
dimitryk

Field Summary
private  double admin
           
private  double business_practices
           
private  double contact
           
private  double current
           
private  double delivery
           
private  double develop
           
private  double historical
           
private  double indefinitely
           
private  double individual_analysis
           
private  double individual_decision
           
private  double legal_requirement
           
private  double no_retention
           
private  double other_purpose
           
private  double other_recipient
           
private  double ours
           
private  double pseudo_analysis
           
private  double pseudo_decision
           
private  double pub
           
private  double same
           
private  double stated_purpose
           
private  double tailoring
           
private  double telemarketing
           
private  double unrelated
           
 
Fields inherited from class com.kpro.algorithm.DistanceMetric
extraArgs, weightsConfig
 
Constructor Summary
bitmapDistance(java.util.Properties weights, java.lang.String[] extraArgs)
           
 
Method Summary
private  double getDistance(PolicyObject a, PolicyObject b, int time)
          the method for distance between PolicyObjects it runs twice in a recursive paten, 1st a/b then b/a
private  double getDistData(Case a, Case b)
          Calculates distance in Data-string from case a to case b using string comparison and multiplies with a STATIC number if 1st strings are not equal
private  double getDistPurpose(Case a, Case b)
          Calculates distance in the Purpose field from case a to case b using bit map distance = a interseption b * weight
private  double getDistRecip(Case a, Case b)
          Calculates distance in the Recipien field from case a to case b using bit map distance = a interseption b * weight
private  double getDistReten(Case a, Case b)
          Calculates distance in the Retention field from case a to case b using bit map distance = a interseption b * weight
private  double getSumDistance(Case a, Case b)
          Returns sum of distances of all fields between case a and b
 double getTotalDistance(PolicyObject a, PolicyObject b)
          Initializes weights and returns the distance between two PolicyObjects.
private  double[] MakePurposeMap(java.util.ArrayList<Purpose> list)
          internal method that makes a bit map of 12 doubles each place in an array corresponds to a spesfic value of a Purpose Enum
private  double[] MakeRecipMap(java.util.ArrayList<Recipient> list)
          internal method that makes a bit map of 6 ints each place in an array corresponds to a spesfic value of a Recipient field
private  double[] MakeRetentionMap(java.util.ArrayList<Retention> list)
          internal method that makes a bit map of 5 ints each place in an array corresponds to a spesfic value of a Retention Enum
private  void setWeights()
          Loads weight to speed upp run time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ours

private double ours

delivery

private double delivery

same

private double same

other_recipient

private double other_recipient

unrelated

private double unrelated

pub

private double pub

current

private double current

admin

private double admin

develop

private double develop

tailoring

private double tailoring

pseudo_analysis

private double pseudo_analysis

pseudo_decision

private double pseudo_decision

individual_analysis

private double individual_analysis

individual_decision

private double individual_decision

contact

private double contact

historical

private double historical

telemarketing

private double telemarketing

other_purpose

private double other_purpose

no_retention

private double no_retention

stated_purpose

private double stated_purpose

legal_requirement

private double legal_requirement

business_practices

private double business_practices

indefinitely

private double indefinitely
Constructor Detail

bitmapDistance

public bitmapDistance(java.util.Properties weights,
                      java.lang.String[] extraArgs)
Method Detail

setWeights

private void setWeights()
Loads weight to speed upp run time


MakeRecipMap

private double[] MakeRecipMap(java.util.ArrayList<Recipient> list)
internal method that makes a bit map of 6 ints each place in an array corresponds to a spesfic value of a Recipient field

Parameters:
list - input arraylist of ReciPients for method...
Returns:
Map as bitmap

MakePurposeMap

private double[] MakePurposeMap(java.util.ArrayList<Purpose> list)
internal method that makes a bit map of 12 doubles each place in an array corresponds to a spesfic value of a Purpose Enum

Parameters:
list - input arraylist of Purpose for method...
Returns:
Map as bitmap

MakeRetentionMap

private double[] MakeRetentionMap(java.util.ArrayList<Retention> list)
internal method that makes a bit map of 5 ints each place in an array corresponds to a spesfic value of a Retention Enum

Parameters:
list - input arraylist of Purpose for method...
Returns:
Map as bitmap

getDistRecip

private double getDistRecip(Case a,
                            Case b)
Calculates distance in the Recipien field from case a to case b using bit map distance = a interseption b * weight

Parameters:
a - input case.
b - input case.
Returns:
dis double for the distance between to.

getDistReten

private double getDistReten(Case a,
                            Case b)
Calculates distance in the Retention field from case a to case b using bit map distance = a interseption b * weight

Parameters:
a - input case.
b - input case.
Returns:
dis double for the distance between to.

getDistData

private double getDistData(Case a,
                           Case b)
Calculates distance in Data-string from case a to case b using string comparison and multiplies with a STATIC number if 1st strings are not equal

Parameters:
a - input case.
b - input case.
Returns:
dis double for the distance between to.

getDistPurpose

private double getDistPurpose(Case a,
                              Case b)
Calculates distance in the Purpose field from case a to case b using bit map distance = a interseption b * weight

Parameters:
a - input case.
b - input case.
Returns:
dis double for the distance between to.

getSumDistance

private double getSumDistance(Case a,
                              Case b)
Returns sum of distances of all fields between case a and b

Parameters:
a - Case
b - Case
Returns:
Sum

getDistance

private double getDistance(PolicyObject a,
                           PolicyObject b,
                           int time)
the method for distance between PolicyObjects it runs twice in a recursive paten, 1st a/b then b/a

Parameters:
a - PolicyObject
b - PolicyObject
time -
Returns:
Distance

getTotalDistance

public double getTotalDistance(PolicyObject a,
                               PolicyObject b)
Initializes weights and returns the distance between two PolicyObjects.

Specified by:
getTotalDistance in class DistanceMetric
Parameters:
a - the 1st policy object
b - the second policy object
Returns:
the distance between the two policy objects