com.kpro.algorithm
Class Bitmapwithdata

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

public class Bitmapwithdata
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
Bitmapwithdata(java.util.Properties weights, java.lang.String[] extraArgs)
           
 
Method Summary
private  double getDistance(PolicyObject a, PolicyObject b, int time)
          Returns the distance between two PolicyObjects, summing the minimum distance from B to A and then the distance from A to B.
private  double getDistData(Case a, Case b)
           
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 the distance between two cases a and b based on purpose, recipient, retention, and data.
 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()
           
 
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

Bitmapwithdata

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

setWeights

private void setWeights()

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)

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 the distance between two cases a and b based on purpose, recipient, retention, and data.

Parameters:
a - the 1st case
b - the 2nd case
Returns:
the distance between cases

getDistance

private double getDistance(PolicyObject a,
                           PolicyObject b,
                           int time)
Returns the distance between two PolicyObjects, summing the minimum distance from B to A and then the distance from A to B.

Parameters:
a - the 1st policy object
b - the second policy object
time - the direction to run- if not called from inside method, it should be 0
Returns:
the distance between the two policy objects

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