Class PairsTableCalculator
Object
PairsTableCalculator
- All Implemented Interfaces:
FeatureCalculatorMulti<FeatureInputPairObjects>,FeatureTableCalculator<FeatureInputPairObjects>
public class PairsTableCalculator
extends Object
implements FeatureTableCalculator<FeatureInputPairObjects>
A feature-session to evaluate pairs of objects.
Successive pairs are evaluated in five different ways:
- the image in which the object exists (on {code listImage}) i.e. the energy-stack.
- the left-object in the pair (on
listSingle) - the right-object in the pair (on
listSingle) - the pair (on {code listPair})
- both objects merged together (on {code listSingle}}
Due to the predictable pattern, feature-calculations can be cached predictably and appropriately to avoid redundancies.
Two types of caching are applied to avoid redundancy:
- The internal calculation caches of first/second/merged are reused as the internal calculation sub-caches in pair.
- The entire results are cached (as a function of the input) for first/second, as the same inputs reappear multiple times.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionPairsTableCalculator(MergedPairsFeatures features) Constructs a PairsTableCalculator with default inclusion and error suppression.PairsTableCalculator(MergedPairsFeatures features, MergedPairsInclude include, boolean suppressErrors) -
Method Summary
Modifier and TypeMethodDescriptioncalculate(FeatureInputPairObjects input) calculate(FeatureInputPairObjects input, FeatureList<FeatureInputPairObjects> featuresSubset) calculateMaybeSuppressErrors(FeatureInputPairObjects input, ErrorReporter errorReporter) Calculates features for the input, optionally suppressing errors.calculateSuppressErrors(FeatureInputPairObjects input, ErrorReporter errorReporter) Creates a list of names for each feature (columns of the table).Makes a copy of the feature-store for a new thread.intvoidstart(ImageInitialization initializtion, Optional<EnergyStack> energyStack, Logger logger) Initializes a feature store that has the same structure as that previously created by createFeatures() from the same object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.anchoranalysis.feature.calculate.bound.FeatureCalculatorMulti
calculate
-
Constructor Details
-
PairsTableCalculator
Constructs a PairsTableCalculator with default inclusion and error suppression.- Parameters:
features- the merged pairs features to use
-
PairsTableCalculator
public PairsTableCalculator(MergedPairsFeatures features, MergedPairsInclude include, boolean suppressErrors)
-
-
Method Details
-
start
public void start(ImageInitialization initializtion, Optional<EnergyStack> energyStack, Logger logger) throws InitializeException Description copied from interface:FeatureTableCalculatorInitializes a feature store that has the same structure as that previously created by createFeatures() from the same object.- Specified by:
startin interfaceFeatureTableCalculator<FeatureInputPairObjects>- Parameters:
initializtion- the image initialization contextenergyStack- an optional energy stack for feature calculationlogger- a logger for reporting initialization progress or errors- Throws:
InitializeException- if initialization fails
-
calculate
- Specified by:
calculatein interfaceFeatureCalculatorMulti<FeatureInputPairObjects>- Throws:
NamedFeatureCalculateException
-
calculate
public ResultsVector calculate(FeatureInputPairObjects input, FeatureList<FeatureInputPairObjects> featuresSubset) - Specified by:
calculatein interfaceFeatureCalculatorMulti<FeatureInputPairObjects>
-
calculateSuppressErrors
public ResultsVector calculateSuppressErrors(FeatureInputPairObjects input, ErrorReporter errorReporter) - Specified by:
calculateSuppressErrorsin interfaceFeatureCalculatorMulti<FeatureInputPairObjects>
-
calculateMaybeSuppressErrors
public ResultsVector calculateMaybeSuppressErrors(FeatureInputPairObjects input, ErrorReporter errorReporter) throws NamedFeatureCalculateException Calculates features for the input, optionally suppressing errors.- Parameters:
input- the input pair of objectserrorReporter- the error reporter to use- Returns:
- the calculated feature results
- Throws:
NamedFeatureCalculateException- if an error occurs during calculation and error suppression is disabled
-
createFeatureNames
Description copied from interface:FeatureTableCalculatorCreates a list of names for each feature (columns of the table).- Specified by:
createFeatureNamesin interfaceFeatureTableCalculator<FeatureInputPairObjects>- Returns:
- the list of feature names
-
sizeFeatures
public int sizeFeatures()- Specified by:
sizeFeaturesin interfaceFeatureCalculatorMulti<FeatureInputPairObjects>
-
duplicateForNewThread
Description copied from interface:FeatureTableCalculatorMakes a copy of the feature-store for a new thread.Deep-copies the features. Shallow-copies everything else.
- Specified by:
duplicateForNewThreadin interfaceFeatureTableCalculator<FeatureInputPairObjects>- Returns:
- the copied feature-store
-