Class LearningCurveExtrapolator

  • All Implemented Interfaces:
    org.api4.java.common.control.ILoggingCustomizable
    Direct Known Subclasses:
    ConfigurationLearningCurveExtrapolator

    public class LearningCurveExtrapolator
    extends java.lang.Object
    implements org.api4.java.common.control.ILoggingCustomizable
    Abstract class for implementing a learning curve extrapolation method with some anchor points. For each of this anchorpoints a subsample will be drawn and a classifier will be trained with this sample. Based on the points (subsample size, learner accuracy) a custom method of learning curve extrapolation can be applied.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> dataset  
      protected LearningCurveExtrapolationMethod extrapolationMethod  
      protected org.api4.java.ai.ml.core.learner.ISupervisedLearner<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance,​org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>> learner  
      protected java.util.Random random  
      protected ASamplingAlgorithm<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>> samplingAlgorithm  
      protected ISamplingAlgorithmFactory<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?>,​? extends ASamplingAlgorithm<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?>>> samplingAlgorithmFactory  
      protected org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> test  
      protected org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> train  
    • Constructor Summary

      Constructors 
      Constructor Description
      LearningCurveExtrapolator​(LearningCurveExtrapolationMethod extrapolationMethod, org.api4.java.ai.ml.core.learner.ISupervisedLearner<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance,​org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>> learner, org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?> dataset, double trainsplit, int[] anchorPoints, ISamplingAlgorithmFactory<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?>,​? extends ASamplingAlgorithm<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?>>> samplingAlgorithmFactory, long seed)
      Create a learning curve extrapolator with a subsampling factory.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.api4.java.ai.ml.core.evaluation.learningcurve.ILearningCurve extrapolateLearningCurve()
      Measure the learner accuracy at the given anchorpoints and extrapolate a learning curve based the results.
      int[] getAnchorPoints()  
      org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?> getDataset()  
      LearningCurveExtrapolationMethod getExtrapolationMethod()  
      org.api4.java.ai.ml.core.learner.ISupervisedLearner<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance,​org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>> getLearner()  
      java.lang.String getLoggerName()  
      int[] getTrainingTimes()  
      double[] getyValues()  
      void setLoggerName​(java.lang.String name)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • learner

        protected org.api4.java.ai.ml.core.learner.ISupervisedLearner<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance,​org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>> learner
      • dataset

        protected org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> dataset
      • train

        protected org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> train
      • test

        protected org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> test
      • samplingAlgorithmFactory

        protected ISamplingAlgorithmFactory<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?>,​? extends ASamplingAlgorithm<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?>>> samplingAlgorithmFactory
      • samplingAlgorithm

        protected ASamplingAlgorithm<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>> samplingAlgorithm
      • random

        protected java.util.Random random
    • Constructor Detail

      • LearningCurveExtrapolator

        public LearningCurveExtrapolator​(LearningCurveExtrapolationMethod extrapolationMethod,
                                         org.api4.java.ai.ml.core.learner.ISupervisedLearner<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance,​org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>> learner,
                                         org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?> dataset,
                                         double trainsplit,
                                         int[] anchorPoints,
                                         ISamplingAlgorithmFactory<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?>,​? extends ASamplingAlgorithm<org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?>>> samplingAlgorithmFactory,
                                         long seed)
                                  throws org.api4.java.ai.ml.core.exception.DatasetCreationException,
                                         java.lang.InterruptedException
        Create a learning curve extrapolator with a subsampling factory.
        Parameters:
        extrapolationMethod - Method for extrapolating a learning curve from anchorpoints.
        learner - Learning model to predict the learning curve of.
        dataset - Dataset to measure evaluate the learner on.
        trainsplit - Portion of the dataset, which shall be used to sample from for training.
        samplingAlgorithmFactory - Subsampling algorithm factory to create a configured subsampler with.
        seed - Random seed.
        Throws:
        org.api4.java.ai.ml.core.exception.DatasetCreationException
        java.lang.InterruptedException
    • Method Detail

      • extrapolateLearningCurve

        public org.api4.java.ai.ml.core.evaluation.learningcurve.ILearningCurve extrapolateLearningCurve()
                                                                                                  throws InvalidAnchorPointsException,
                                                                                                         org.api4.java.algorithm.exceptions.AlgorithmException,
                                                                                                         java.lang.InterruptedException
        Measure the learner accuracy at the given anchorpoints and extrapolate a learning curve based the results.
        Parameters:
        anchorPoints - Sample sizes as anchorpoints, where the true accuracy shall be measured.
        Returns:
        The extrapolated learning curve.
        Throws:
        InvalidAnchorPointsException - The anchorpoints (amount, values, ...) are not suitable for the given learning curve extrapolation method.
        org.api4.java.algorithm.exceptions.AlgorithmException - An error occured during the creation of the specified anchorpoints.
        java.lang.InterruptedException
      • getLearner

        public org.api4.java.ai.ml.core.learner.ISupervisedLearner<org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance,​org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance>> getLearner()
      • getDataset

        public org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<?> getDataset()
      • getAnchorPoints

        public int[] getAnchorPoints()
      • getyValues

        public double[] getyValues()
      • getTrainingTimes

        public int[] getTrainingTimes()
      • getLoggerName

        public java.lang.String getLoggerName()
        Specified by:
        getLoggerName in interface org.api4.java.common.control.ILoggingCustomizable
      • setLoggerName

        public void setLoggerName​(java.lang.String name)
        Specified by:
        setLoggerName in interface org.api4.java.common.control.ILoggingCustomizable