Class ASimpleScikitLearnWrapper<P extends org.api4.java.ai.ml.core.evaluation.IPrediction,​B extends org.api4.java.ai.ml.core.evaluation.IPredictionBatch>

  • All Implemented Interfaces:
    IScikitLearnWrapper, org.api4.java.ai.ml.core.learner.IFittable<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>>, org.api4.java.ai.ml.core.learner.IFittablePredictor<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>>, org.api4.java.ai.ml.core.learner.ILearnerConfigHandler, org.api4.java.ai.ml.core.learner.IPredictor<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>>, 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>>, org.api4.java.common.control.ILoggingCustomizable
    Direct Known Subclasses:
    SimpleScikitLearnClassifier, SimpleScikitLearnRegressor

    public abstract class ASimpleScikitLearnWrapper<P extends org.api4.java.ai.ml.core.evaluation.IPrediction,​B extends org.api4.java.ai.ml.core.evaluation.IPredictionBatch>
    extends ASupervisedLearner<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>,​P,​B>
    implements IScikitLearnWrapper
    • Field Detail

      • PYTHON_MINIMUM_REQUIRED_VERSION_REL

        public static final int PYTHON_MINIMUM_REQUIRED_VERSION_REL
        See Also:
        Constant Field Values
      • PYTHON_MINIMUM_REQUIRED_VERSION_MAJ

        public static final int PYTHON_MINIMUM_REQUIRED_VERSION_MAJ
        See Also:
        Constant Field Values
      • PYTHON_MINIMUM_REQUIRED_VERSION_MIN

        public static final int PYTHON_MINIMUM_REQUIRED_VERSION_MIN
        See Also:
        Constant Field Values
      • PYTHON_REQUIRED_MODULES

        protected static final java.lang.String[] PYTHON_REQUIRED_MODULES
      • PYTHON_OPTIONAL_MODULES

        protected static final java.lang.String[] PYTHON_OPTIONAL_MODULES
      • pythonC

        protected ai.libs.python.IPythonConfig pythonC
      • problem

        protected final java.lang.String problem
      • constructorCall

        protected final java.lang.String constructorCall
      • imports

        protected final java.lang.String imports
      • trainingData

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

      • ASimpleScikitLearnWrapper

        protected ASimpleScikitLearnWrapper​(java.lang.String constructorCall,
                                            java.lang.String imports,
                                            java.lang.String problem)
                                     throws java.io.IOException,
                                            java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • ASimpleScikitLearnWrapper

        protected ASimpleScikitLearnWrapper​(java.lang.String constructorCall,
                                            java.lang.String imports,
                                            java.lang.String problem,
                                            ai.libs.python.IPythonConfig pythonConfig)
                                     throws java.io.IOException,
                                            java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
    • Method Detail

      • fit

        public void fit​(org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> dTrain)
                 throws org.api4.java.ai.ml.core.exception.TrainingException,
                        java.lang.InterruptedException
        Specified by:
        fit in interface org.api4.java.ai.ml.core.learner.IFittable<P extends org.api4.java.ai.ml.core.evaluation.IPrediction,​B extends org.api4.java.ai.ml.core.evaluation.IPredictionBatch>
        Throws:
        org.api4.java.ai.ml.core.exception.TrainingException
        java.lang.InterruptedException
      • 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
      • setModelPath

        public void setModelPath​(java.lang.String modelPath)
                          throws java.io.IOException
        Specified by:
        setModelPath in interface IScikitLearnWrapper
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • fit

        public void fit​(java.lang.String trainingDataName)
                 throws org.api4.java.ai.ml.core.exception.TrainingException,
                        java.lang.InterruptedException
        Specified by:
        fit in interface IScikitLearnWrapper
        Throws:
        org.api4.java.ai.ml.core.exception.TrainingException
        java.lang.InterruptedException
      • setPythonTemplate

        public void setPythonTemplate​(java.lang.String pythonTemplatePath)
                               throws java.io.IOException
        Specified by:
        setPythonTemplate in interface IScikitLearnWrapper
        Throws:
        java.io.IOException
      • setPythonConfig

        public void setPythonConfig​(ai.libs.python.IPythonConfig pythonConfig)
                             throws java.io.IOException,
                                    java.lang.InterruptedException
        Specified by:
        setPythonConfig in interface IScikitLearnWrapper
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • getDataName

        public java.lang.String getDataName​(org.api4.java.ai.ml.core.dataset.supervised.ILabeledDataset<? extends org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance> data)
        Specified by:
        getDataName in interface IScikitLearnWrapper
      • predict

        public B predict​(org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance[] dTest)
                  throws org.api4.java.ai.ml.core.exception.PredictionException,
                         java.lang.InterruptedException
        Specified by:
        predict in interface org.api4.java.ai.ml.core.learner.IPredictor<P extends org.api4.java.ai.ml.core.evaluation.IPrediction,​B extends org.api4.java.ai.ml.core.evaluation.IPredictionBatch>
        Specified by:
        predict in class ASupervisedLearner<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>,​P extends org.api4.java.ai.ml.core.evaluation.IPrediction,​B extends org.api4.java.ai.ml.core.evaluation.IPredictionBatch>
        Throws:
        org.api4.java.ai.ml.core.exception.PredictionException
        java.lang.InterruptedException
      • predict

        public P predict​(org.api4.java.ai.ml.core.dataset.supervised.ILabeledInstance xTest)
                  throws org.api4.java.ai.ml.core.exception.PredictionException,
                         java.lang.InterruptedException
        Specified by:
        predict in interface org.api4.java.ai.ml.core.learner.IPredictor<P extends org.api4.java.ai.ml.core.evaluation.IPrediction,​B extends org.api4.java.ai.ml.core.evaluation.IPredictionBatch>
        Specified by:
        predict in class ASupervisedLearner<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>,​P extends org.api4.java.ai.ml.core.evaluation.IPrediction,​B extends org.api4.java.ai.ml.core.evaluation.IPredictionBatch>
        Throws:
        org.api4.java.ai.ml.core.exception.PredictionException
        java.lang.InterruptedException