Class GridSearch
java.lang.Object
de.uni_mannheim.informatik.dws.melt.matching_eval.paramtuning.GridSearch
GridSearch for ontology matching with an arbitrary amount of parameter and values to optimize.
Important: when using parallel processing, ensure that the matcher does not write to the same results file.
- Author:
- Sven Hertling
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final String
constructor constant to be used inaddParameter(String, List)
.private static final org.slf4j.Logger
Default loggerprivate Class<?>
The matcher under evaluation.private String
-
Constructor Summary
ConstructorDescriptionGridSearch
(Class<?> matcher) ConstructorGridSearch
(Class<?> matcher, String matcherName) Constructor -
Method Summary
Modifier and TypeMethodDescriptionaddConstructorParameter
(List<Object> paramValues) In case the matcher needs parameters in the constructor which should be changed in each run, use this method.addConstructorParameter
(List<Object> paramValues, Class<?> clazz) In case the matcher needs parameters in the constructor which should be changed in each run, use this method.addParameter
(String name, Object... paramValues) Adds a parameter search.addParameter
(String name, List<Object> paramValues) Adds a parameter search.Adds a multiple parameter searches.addParameters
(Map<String, List<Object>> paramsToValuesGrid) Adds a multiple parameter searches.addStaticConstructorParameter
(Object... paramValues) In case you need parameters for the matcher constructor, but do not want the change them in each run, but keep them the same, then use this method.addStaticConstructorParameter
(List<Object> paramValues, List<Class<?>> paramTypes) In case you need parameters for the matcher constructor, but do not want the change them in each run, but keep them the same, then use this method.cartesianProduct
(int index, List<List<Object>> paramValues) private Object
getInstantiatedMatcher
(List<Object> paramValue) protected String
getMatcherNameWithSettings
(List<Object> paramValue) private static boolean
isConstructorParameter
(String parameterName) runGridParallel
(TestCase testCase) Run in parallel onTestCase
.runGridParallel
(TestCase testCase, int numberOfThreads) runGridParallel
(Track track) runGridParallel
(Track track, int numberOfThreads) runGridParallel
(List<TestCase> testCases) Run in parallel on multipleTestCase
.runGridParallel
(List<TestCase> testCases, int numberOfThreads) runGridParallelTrack
(List<Track> tracks, int numberOfThreads) runGridParallelTracks
(List<Track> tracks) runGridSequential
(TestCase testCase) Run sequentially on aTestCase
.runGridSequential
(Track track) Run sequentially aTrack
.runGridSequential
(List<TestCase> testCases) Run sequentially on multipleTestCase
.runGridSequentialTracks
(List<Track> tracks) Run sequentially on multipleTrack
.Updates the execution result set with configuration attributes in the extension of the alignment.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGERDefault logger -
CONSTRUCTOR
constructor constant to be used inaddParameter(String, List)
.- See Also:
-
matcher
The matcher under evaluation. -
matcherName
-
paramName
-
paramValues
-
paramTypes
-
-
Constructor Details
-
GridSearch
Constructor- Parameters:
matcher
- The matcher for which the grid search shall be performed.matcherName
- Name of the matcher.
-
GridSearch
Constructor- Parameters:
matcher
- The matcher for which the grid search shall be performed.
-
-
Method Details
-
addParameters
Adds a multiple parameter searches. The name (key of the map) can be a nested property. Example values for parameter "name" are:- "a" -- sets the value of property a of the specified bean
- "a.b" -- gets the value of property a of the specified bean, then on that object sets the value of property b.
- "a(key)" -- sets a value of mapped-property a on the specified bean. This effectively means bean.setA("key").
- "a[3]" -- sets a value of indexed-property a on the specified bean. This effectively means bean.setA(3).
- Parameters:
paramsToValuesGrid
- a map where the key is a possibly nested name of the property to be modified and the values to which the property is to be set- Returns:
- GridSearch object (for builder pattern)
-
addParameters
Adds a multiple parameter searches. The names can be a nested property. Example values for parameter "name" are:- "a" -- sets the value of property a of the specified bean
- "a.b" -- gets the value of property a of the specified bean, then on that object sets the value of property b.
- "a(key)" -- sets a value of mapped-property a on the specified bean. This effectively means bean.setA("key").
- "a[3]" -- sets a value of indexed-property a on the specified bean. This effectively means bean.setA(3).
- Parameters:
paramsNames
- Possibly nested name of the property to be modifiedparamsValues
- Values to which the property is to be set- Returns:
- GridSearch object (for builder pattern)
-
addParameter
Adds a parameter search. The name can be a nested property. Example values for parameter "name" are:- "a" -- sets the value of property a of the specified bean
- "a.b" -- gets the value of property a of the specified bean, then on that object sets the value of property b.
- "a(key)" -- sets a value of mapped-property a on the specified bean. This effectively means bean.setA("key").
- "a[3]" -- sets a value of indexed-property a on the specified bean. This effectively means bean.setA(3).
- Parameters:
name
- Possibly nested name of the property to be modified.paramValues
- Values to which the property is to be set.- Returns:
- GridSearch object (for builder pattern).
-
addParameter
Adds a parameter search. The name can be a nested property. Example values for parameter "name" are:- "a" -- sets the value of property a of the specified bean
- "a.b" -- gets the value of property a of the specified bean, then on that object sets the value of property b.
- "a(key)" -- sets a value of mapped-property a on the specified bean. This effectively means bean.setA("key").
- "a[3]" -- sets a value of indexed-property a on the specified bean. This effectively means bean.setA(3).
- Parameters:
name
- Possibly nested name of the property to be modifiedparamValues
- Values to which the property is to be set- Returns:
- GridSearch object (for builder pattern)
-
addConstructorParameter
In case the matcher needs parameters in the constructor which should be changed in each run, use this method. If the constructor of the matcher has n parameters you should call this method n times with values which should be tried out. If the constructor looks like this:
then you should call it like that (order matters!)public MyMatcher(int number, String text){ }
to have the following calls of the constructor:gridsearch.addConstructorParameter(1,2,3); gridsearch.addConstructorParameter("x", "y");
In case you just want to provide constructor parameters which should not be changed, usenew MyMatcher(1, "x") new MyMatcher(2, "x") new MyMatcher(3, "x") new MyMatcher(1, "y") new MyMatcher(2, "y") new MyMatcher(3, "y")
addStaticConstructorParameter(java.lang.Object...)
- Parameters:
paramValues
- The parameters for the constructor in the correct order.- Returns:
- Edited
GridSearch
instance.
-
addConstructorParameter
In case the matcher needs parameters in the constructor which should be changed in each run, use this method. If the constructor of the matcher has n parameters you should call this method n times with values which should be tried out. If the constructor looks like this:
then you should call it like that (order matters!)public MyMatcher(int number, String text){ }
to have the following calls of the constructor:gridsearch.addConstructorParameter(Arrays.asList(1,2,3), Integer.class); gridsearch.addConstructorParameter(Arrays.asList("x", "y"), String.class);
In case you just want to provide constructor parameters which should not be changed, usenew MyMatcher(1, "x") new MyMatcher(2, "x") new MyMatcher(3, "x") new MyMatcher(1, "y") new MyMatcher(2, "y") new MyMatcher(3, "y")
addStaticConstructorParameter(java.lang.Object...)
- Parameters:
paramValues
- The parameters for the constructor in the correct order.clazz
- The type of all the values.- Returns:
- Edited
GridSearch
instance.
-
addStaticConstructorParameter
In case you need parameters for the matcher constructor, but do not want the change them in each run, but keep them the same, then use this method. In case you supply multiple values, the constructor should also need the same amount of parameters (position matters!). This differ toaddConstructorParameter(java.util.List)
because it does not change the constructor paramters in each run. In case the constructor is not found (java.lang.NoSuchMethodException) then useaddStaticConstructorParameter(java.util.List, java.util.List)
and specify the types explicitly.- Parameters:
paramValues
- The parameters for the constructor in the correct order.- Returns:
- Edited
GridSearch
instance.
-
addStaticConstructorParameter
public GridSearch addStaticConstructorParameter(List<Object> paramValues, List<Class<?>> paramTypes) In case you need parameters for the matcher constructor, but do not want the change them in each run, but keep them the same, then use this method. In case you supply multiple values, the constructor should also need the same amount of parameters (position matters!). This differ toaddConstructorParameter(java.util.List)
because it does not change the constructor paramters in each run.- Parameters:
paramValues
- The parameters values for the constructor in the correct order.paramTypes
- The parameter type of the constructor in the correct order.- Returns:
- Edited
GridSearch
instance.
-
runGridParallel
Run in parallel onTestCase
.- Parameters:
testCase
- The test case to use.- Returns:
ExecutionResultSet
instance.
-
runGridParallel
Run in parallel on multipleTestCase
.- Parameters:
testCases
- The test cases to use.- Returns:
ExecutionResultSet
instance.
-
runGridParallel
-
runGridParallelTracks
-
runGridParallel
-
runGridParallel
-
runGridParallel
-
runGridParallelTrack
-
runGridSequential
Run sequentially on aTestCase
.- Parameters:
testCase
- The test case to use.- Returns:
ExecutionResultSet
instance.
-
runGridSequential
Run sequentially on multipleTestCase
.- Parameters:
testCases
- The test cases to use.- Returns:
ExecutionResultSet
instance.
-
runGridSequential
Run sequentially aTrack
.- Parameters:
track
- The track to use.- Returns:
ExecutionResultSet
instance.
-
runGridSequentialTracks
Run sequentially on multipleTrack
.- Parameters:
tracks
- The tracks to use.- Returns:
ExecutionResultSet
instance.
-
updateExecutionResultSet
Updates the execution result set with configuration attributes in the extension of the alignment.- Parameters:
set
- The execution result set to be updated.- Returns:
- The updated execution result set.
-
getMatcherConfigurations
-
getMatcherNameWithSettings
-
getInstantiatedMatcher
- Throws:
ReflectiveOperationException
-
isConstructorParameter
-
cartesianProduct
-