Class TransformersFineTunerHpSearch

All Implemented Interfaces:
Filter, IMatcher<org.apache.jena.ontology.OntModel,Alignment,Properties>, eu.sealsproject.platform.res.domain.omt.IOntologyMatchingToolBridge, eu.sealsproject.platform.res.tool.api.IPlugin, eu.sealsproject.platform.res.tool.api.IToolBridge

public class TransformersFineTunerHpSearch extends TransformersFineTuner implements Filter
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • numberOfTrials

      private int numberOfTrials
      the number of different hyperparamter combinations which are tried out
    • testSize

      private float testSize
      A number between zero and one which represents the proportion of the data to include in the test split
    • optimizingMetric

      private TransformersOptimizingMetric optimizingMetric
      The metric to optimize during hyperparameter search.
    • hpSpace

      private TransformersHpSearchSpace hpSpace
      The initial hyper parameter search space. For nearly all algorithms except PBT, this is the only search space which should be defined.
    • hpMutations

      private TransformersHpSearchSpace hpMutations
      These are the mutations for the hyperparameter - only applicable for PBT (population based training).
  • Constructor Details

    • TransformersFineTunerHpSearch

      public TransformersFineTunerHpSearch(TextExtractorMap extractor, String initialModelName, File resultingModelLocation)
    • TransformersFineTunerHpSearch

      public TransformersFineTunerHpSearch(TextExtractor extractor, String initialModelName, File resultingModelLocation)
  • Method Details

    • finetuneModel

      public File finetuneModel(File trainingFile) throws Exception
      Finetune a given model with the provided text in the csv file (three columns: first text, second text, label(0/1))
      Overrides:
      finetuneModel in class TransformersFineTuner
      Parameters:
      trainingFile - csv file with three columns: first text, second text, label(0/1)
      Returns:
      the final location (directory) of the finetuned model (which is also given in the constructor)
      Throws:
      Exception - in case of any error
    • getNumberOfTrials

      public int getNumberOfTrials()
      Returns the number of trials which should be executed during hyperparameter search. This means how many different hyperparameter combinations should be tried out. The more the better, but also takes more time.
      Returns:
      the number of different hyperparamter combinations which are executed
    • setNumberOfTrials

      public void setNumberOfTrials(int numberOfTrials)
      Sets the number of trials which should be executed during hyperparameter search. This means how many different hyperparameter combinations should be tried out. The more the better, but also takes more time.
      Parameters:
      numberOfTrials - the number of different hyperparamter combinations which are executed
    • getTestSize

      public float getTestSize()
      Returns a number between zero and one which represents the proportion of the data to include in the test split.
      Returns:
      a number between zero and one which represents the proportion of the data to include in the test split
    • setTestSize

      public void setTestSize(float testSize)
      Sets the number between zero and one which represents the proportion of the data to include in the test split
      Parameters:
      testSize - number between zero and one which represents the proportion of the data to include in the test split
    • getOptimizingMetric

      public TransformersOptimizingMetric getOptimizingMetric()
      Returns the metric which is optimized during hyperparameter search.
      Returns:
      the metric which is optimized during hyperparameter search
    • setOptimizingMetric

      public void setOptimizingMetric(TransformersOptimizingMetric optimizingMetric)
      Sets the metric which is optimized during hyperparameter search.
      Parameters:
      optimizingMetric - the metric which is optimized during hyperparameter search
    • getHpSpace

      public TransformersHpSearchSpace getHpSpace()
      Returns the initial hyper parameter search space. For nearly all algorithms except PBT, this is the only search space which should be defined.
      Returns:
      the initial hyper parameter search space.
    • setHpSpace

      public void setHpSpace(TransformersHpSearchSpace hpSpace)
      Sets the initial hyper parameter search space. For nearly all algorithms except PBT, this is the only search space which should be defined.
      Parameters:
      hpSpace - the initial hyper parameter search space
    • getHpMutations

      public TransformersHpSearchSpace getHpMutations()
      Returns the mutations for the hyperparameter - only applicable for PBT (population based training).
      Returns:
      the mutations for the hyperparameter
    • setHpMutations

      public void setHpMutations(TransformersHpSearchSpace hpMutations)
      Sets the mutations for the hyperparameter - only applicable for PBT (population based training).
      Parameters:
      hpMutations - the mutations for the hyperparameter