Package org.aksw.limes.core.ml.algorithm
Class ACoreMLAlgorithm
- java.lang.Object
-
- org.aksw.limes.core.ml.algorithm.ACoreMLAlgorithm
-
-
Field Summary
Fields Modifier and Type Field Description protected Configurationconfigurationprotected List<LearningParameter>learningParametersprotected static org.slf4j.Loggerloggerprotected ACachesourceCacheprotected ACachetargetCache
-
Constructor Summary
Constructors Constructor Description ACoreMLAlgorithm()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract MLResultsactiveLearn()Learning method for supervised active core ML algorithm implementations Normally, it is used as a first step to initialize the ML model before going through the active learning processprotected abstract MLResultsactiveLearn(AMapping oracleMapping)Learning method for supervised active core ML algorithm implementations.ConfigurationgetConfiguration()protected abstract StringgetName()Name of the core ML algorithm.protected abstract AMappinggetNextExamples(int size)Get a set of examples to be added to the mapping.protected ObjectgetParameter(String name)Get parameter by name.protected List<LearningParameter>getParameters()ACachegetSourceCache()ACachegetTargetCache()protected voidinit(List<LearningParameter> learningParameters, ACache sourceCache, ACache targetCache)Initialize the core ML algorithm.protected abstract MLResultslearn(PseudoFMeasure pfm)Learning method for unsupervised core ML algorithm implementations.protected abstract MLResultslearn(AMapping trainingData)Learning method for supervised core ML algorithm implementations, where the confidence values for each pair in the trainingData determine its truth degree.protected abstract AMappingpredict(ACache source, ACache target, MLResults mlModel)Predict/generate links from source to target based on mlModel.voidsetConfiguration(Configuration configuration)abstract voidsetDefaultParameters()Set default ACoreMLAlgorithm parameters valuesvoidsetParameter(String par, Object val)protected abstract booleansupports(MLImplementationType mlType)Check whether the mlType is supported.
-
-
-
Field Detail
-
logger
protected static org.slf4j.Logger logger
-
learningParameters
protected List<LearningParameter> learningParameters
-
sourceCache
protected ACache sourceCache
-
targetCache
protected ACache targetCache
-
configuration
protected Configuration configuration
-
-
Method Detail
-
getConfiguration
public Configuration getConfiguration()
- Returns:
- the configuration
-
setConfiguration
public void setConfiguration(Configuration configuration)
- Parameters:
configuration- the configuration
-
getName
protected abstract String getName()
Name of the core ML algorithm.- Returns:
- Name of the core ML algorithm.
-
getParameters
protected List<LearningParameter> getParameters()
- Returns:
- current core ML algorithm parameters and their default values
-
setDefaultParameters
public abstract void setDefaultParameters()
Set default ACoreMLAlgorithm parameters values
-
init
protected void init(List<LearningParameter> learningParameters, ACache sourceCache, ACache targetCache)
Initialize the core ML algorithm.- Parameters:
learningParameters- learning parameterssourceCache- the source cachetargetCache- the target cache
-
learn
protected abstract MLResults learn(AMapping trainingData) throws UnsupportedMLImplementationException
Learning method for supervised core ML algorithm implementations, where the confidence values for each pair in the trainingData determine its truth degree.- Parameters:
trainingData- used for learning- Returns:
- wrap with results
- Throws:
UnsupportedMLImplementationException- if ML implementation is not supported
-
learn
protected abstract MLResults learn(PseudoFMeasure pfm) throws UnsupportedMLImplementationException
Learning method for unsupervised core ML algorithm implementations.- Parameters:
pfm- pseudo F-measure for unsupervised learning- Returns:
- wrap with results
- Throws:
UnsupportedMLImplementationException- if ML implementation is not supported
-
predict
protected abstract AMapping predict(ACache source, ACache target, MLResults mlModel)
Predict/generate links from source to target based on mlModel.- Parameters:
source- Cachetarget- CachemlModel- result of training phase- Returns:
- the mapping from source to target
-
supports
protected abstract boolean supports(MLImplementationType mlType)
Check whether the mlType is supported.- Parameters:
mlType- machine learning implementation type- Returns:
- a boolean value
-
getNextExamples
protected abstract AMapping getNextExamples(int size) throws UnsupportedMLImplementationException
Get a set of examples to be added to the mapping.- Parameters:
size- of the examples- Returns:
- the mapping
- Throws:
UnsupportedMLImplementationException- Exception
-
activeLearn
protected abstract MLResults activeLearn(AMapping oracleMapping) throws UnsupportedMLImplementationException
Learning method for supervised active core ML algorithm implementations.- Parameters:
oracleMapping- mapping from the oracle- Returns:
- wrap with results
- Throws:
UnsupportedMLImplementationException- if ML implementation is not supported
-
activeLearn
protected abstract MLResults activeLearn() throws UnsupportedMLImplementationException
Learning method for supervised active core ML algorithm implementations Normally, it is used as a first step to initialize the ML model before going through the active learning process- Returns:
- wrap with results
- Throws:
UnsupportedMLImplementationException- if ML implementation is not supported
-
getParameter
protected Object getParameter(String name)
Get parameter by name.- Parameters:
name- parameter name- Returns:
- the parameter as Object
- Throws:
NoSuchParameterException- if parameter is not exists
-
setParameter
public void setParameter(String par, Object val)
- Parameters:
par- parameter nameval- parameter value
-
getSourceCache
public ACache getSourceCache()
- Returns:
- the source cache
-
getTargetCache
public ACache getTargetCache()
- Returns:
- the target cache
-
-