Skip navigation links
net.sf.tweety.machinelearning

Class GridSearchParameterLearner<S extends Observation,T extends Category>

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      private int depth
      The depth of the recursion.
      private int partitions
      The number of partitions of each parameter interval.
      private ClassificationTester<S,T> tester
      The tester used for measuring the performance of each parameter combination.
    • Field Detail

      • depth

        private int depth
        The depth of the recursion.
      • partitions

        private int partitions
        The number of partitions of each parameter interval.
    • Constructor Detail

      • GridSearchParameterLearner

        public GridSearchParameterLearner(Trainer<S,T> trainer,
                                          ClassificationTester<S,T> tester,
                                          int depth,
                                          int partitions)
        Creates a new grid-search parameter learner with the given arguments.
        Parameters:
        trainer - some trainer.
        tester - some classification tester for measuring performance.
        depth - the depth of the recursion.
        partitions - the number of partitions.
    • Method Detail

      • adjustParameterSet

        private ParameterSet adjustParameterSet(ParameterSet set,
                                                int[] indices,
                                                double[] lowerBounds,
                                                double[] upperBounds)
        Determine for all parameters of the set a new value, determined by partitioning [lowerBound,upperBound] into this.partitions number of sub intervals and then taking the center point of the partition no. idx.
        Parameters:
        set - a parameter set
        indices - indices
        lowerBounds - the lower bounds
        upperBounds - the upper bounds
        Returns:
        a new parameter set
      • increment

        private boolean increment(int[] indices,
                                  int maxIdx)
        Increments the given array of indices, e.g. (for maxIdx=5) given [0,0,0,0] it returns [1,0,0,0], given [4,2,1,4] it returns [5,2,1,4], given [5,2,1,4] it returns [0,3,1,4], given [5,5,1,4] it returns [0,0,2,4], etc. It returns true iff an overflow occurs, e.g. if [5,5,5,5] is to be incremented.
        Parameters:
        indices - an array of ints.
        maxIdx - the max index.
        Returns:
        "true" iff an overflow occurs