Class AddMetric
- java.lang.Object
-
- org.jgap.gp.CommandGene
-
- org.aksw.limes.core.ml.algorithm.eagle.genes.AddMetric
-
- All Implemented Interfaces:
Serializable,Cloneable,Comparable,org.jgap.gp.IMutateable,org.jgap.util.ICloneable
public class AddMetric extends org.jgap.gp.CommandGene implements org.jgap.gp.IMutateable, org.jgap.util.ICloneableClass to implement the ADD command for evolution of metric expressions. A ADD Command combines Similarity Measures with coefficients. E.g. "ADD(0.5*trigram(x.title,y.title)|0.9, 0.5*cosine(x.authors,y.authors)|0.7)". So LIMES recalculates the thresholds: threshold1 = (threshold - coef2) / coef1;- Version:
- Jul 21, 2016
- Author:
- Klaus Lyko, Mohamed Sherif (sherif@informatik.uni-leipzig.de)
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.jgap.gp.CommandGeneapplyMutation()org.jgap.gp.CommandGeneapplyMutation(int a_index, double a_percentage)Objectclone()Objectexecute_object(org.jgap.gp.impl.ProgramChromosome a_chrom, int a_n, Object[] args)voidexecute_void(org.jgap.gp.impl.ProgramChromosome a_chrom, int a_n, Object[] args)Class<?>getChildType(org.jgap.gp.IGPProgram a_ind, int a_chromNum)We're expecting 2 pairs of aSimilarityCommand and a coefficient.static StringremoveThresholdFromMeasure(String measure)ADD metrics only have coefficients no local thresholds.StringtoString()-
Methods inherited from class org.jgap.gp.CommandGene
check, check, cleanup, compareTo, dynamizeArity, ensureUniqueness, ensureUniqueness, ensureUniqueness2, equals, execute, execute_boolean, execute_double, execute_float, execute_int, execute_long, getAllele, getApplicationData, getArity, getArityMax, getArityMin, getCommandType, getEnergy, getGPConfiguration, getInternalValue, getName, getPersistentRepresentation, getPersistentRepresentationExt, getReturnType, getSubChildType, getSubChildTypes, getSubReturnType, hashCode, init, isAffectGlobalState, isCompareApplicationData, isFloatType, isIntegerType, isValid, isValid, setAllele, setApplicationData, setArity, setArityMax, setArityMin, setCompareApplicationData, setEnergy, setNoValidation, setReturnType, setToRandomValue, setValueFromPersistentRepresentation, setValueFromString, size
-
-
-
-
Constructor Detail
-
AddMetric
public AddMetric(org.jgap.gp.impl.GPConfiguration config) throws org.jgap.InvalidConfigurationExceptionDefault Constructor. Setting return type to String.class and making ADD no candidate for mutation.- Parameters:
config- A GPConfiguration- Throws:
org.jgap.InvalidConfigurationException- when an invalid value has been passed to a Configuration object
-
AddMetric
public AddMetric(org.jgap.gp.impl.GPConfiguration config, Class<?> a_returnType, boolean mutateable) throws org.jgap.InvalidConfigurationExceptionConstructor to manually set return type.- Parameters:
config- A GPConfigurationa_returnType- Class this CommandGene returns on executing.- Throws:
org.jgap.InvalidConfigurationException- when an invalid value has been passed to a Configuration object
-
-
Method Detail
-
removeThresholdFromMeasure
public static String removeThresholdFromMeasure(String measure)
ADD metrics only have coefficients no local thresholds. So this function removes them.- Parameters:
measure- , e.g. trigrams(s.x,t.y)|0.8- Returns:
- shortened measure, e.g. trigrams(s.x,t.y)
-
toString
public String toString()
- Specified by:
toStringin classorg.jgap.gp.CommandGene
-
getChildType
public Class<?> getChildType(org.jgap.gp.IGPProgram a_ind, int a_chromNum)
We're expecting 2 pairs of aSimilarityCommand and a coefficient.- Overrides:
getChildTypein classorg.jgap.gp.CommandGene- Parameters:
a_ind- A GPPrograma_chromNum- The number of the chromosome.- Returns:
- Class type of the child.
-
execute_object
public Object execute_object(org.jgap.gp.impl.ProgramChromosome a_chrom, int a_n, Object[] args)
- Overrides:
execute_objectin classorg.jgap.gp.CommandGene
-
execute_void
public void execute_void(org.jgap.gp.impl.ProgramChromosome a_chrom, int a_n, Object[] args)- Overrides:
execute_voidin classorg.jgap.gp.CommandGene
-
applyMutation
public org.jgap.gp.CommandGene applyMutation(int a_index, double a_percentage) throws org.jgap.InvalidConfigurationException- Specified by:
applyMutationin interfaceorg.jgap.gp.IMutateable- Throws:
org.jgap.InvalidConfigurationException
-
applyMutation
public org.jgap.gp.CommandGene applyMutation() throws org.jgap.InvalidConfigurationException- Returns:
- CommandGene
- Throws:
org.jgap.InvalidConfigurationException- when an invalid value has been passed to a Configuration object
-
-