SG++-Doxygen-Documentation
Loading...
Searching...
No Matches
python.learner.LearnerBuilder.LearnerBuilder Class Reference

Implement mechanisms to create customized learning system. More...

Inheritance diagram for python.learner.LearnerBuilder.LearnerBuilder:

Classes

class  CGSolverDescriptor
 CGSolver Descriptor helps to implement fluid interface patter on python it encapsulates functionality concerning creation of the CG-Solver. More...
 
class  FoldingDescriptor
 Folding Descriptor helps to implement fluid interface patter on python it encapsulates functionality concerning the usage for N-fold cross-validation. More...
 
class  GridDescriptor
 Grid Descriptor helps to implement fluid interface patter on python it encapsulates functionality concerning creation of the grid. More...
 
class  SpecificationDescriptor
 TrainingSpecification Descriptor helps to implement fluid interface patter on python it encapsulates functionality concerning creation of the training specification. More...
 
class  StopPolicyDescriptor
 TrainingStopPolicy Descriptor helps to implement fluid interface patter on python it encapsulates functionality concerning creation of the training stop policy. More...
 

Public Member Functions

 __init__ (self)
 Default constuctor.
 
 andGetResult (self)
 Returns the builded learner (regressor or classifier), should be called at the end of construction.
 
 buildClassifier (self)
 Start building Classifier.
 
 buildRegressor (self)
 Start building Regressor.
 
 getCheckpointController (self)
 Returns the checkpoint controller.
 
 getLearner (self)
 Returns the object of learner subclass, that is currently beeing constructed.
 
 withCGSolver (self)
 Start description of parameters of CG-Solver for learner.
 
 withCheckpointController (self, controller)
 Attaches checkpoint controller to the learner.
 
 withFilesFoldingPolicy (self)
 Signals to use N-fold cross validation from a set of files.
 
 withGrid (self)
 Start description of parameters of CG-Solver for learner.
 
 withInitialAlphaFromARFFFile (self, filename)
 Signals to use initial data for alpha vector from ARFF file.
 
 withProgressPresenter (self, presentor)
 Attaches progress presentor to the learner.
 
 withRandomFoldingPolicy (self)
 Signals to use N-fold cross validation with random folding rule.
 
 withSequentialFoldingPolicy (self)
 Signals to use N-fold cross validation with sequential folding rule.
 
 withSpecification (self)
 Start description of specification parameters for learner.
 
 withStartingIterationNumber (self, iteration)
 Set the starting iteration number ane return the builder object.
 
 withStopPolicy (self)
 Start description of parameters of stop-policy for learner.
 
 withStratifiedFoldingPolicy (self)
 Signals to use N-fold cross validation with stratified folding rule.
 
 withTestingDataFromARFFFile (self, filename)
 Signals to use data from ARFF file for testing dataset.
 
 withTestingDataFromCSVFile (self, filename)
 Signals to use data from CSV file for testing dataset.
 
 withTestingDataFromNumPyArray (self, points, values, name="test")
 
 withTrainingDataFromARFFFile (self, filename, name="train")
 Signals to use data from ARFF file for training dataset.
 
 withTrainingDataFromCSVFile (self, filename, name="train")
 Signals to use data from CSV file for training dataset.
 
 withTrainingDataFromNumPyArray (self, points, values, name="train")
 

Detailed Description

Implement mechanisms to create customized learning system.

Usage examples

To create a learning system first define if it should be for classification

import from pysgpp.extensions.datadriven.learner.LearnerBuilder as LearnerBuilder
builder = LearnerBuilder()
builder = builder.buildClassifier()

or regression

builder = builder.buildRegressor()

LearnerBuilder is implementing Fluent Interface design pattern it means it operates as an automata, switching in some state where you can set all parameters associated with some category. For example to define the grid parameters you switch the builder into GridDescriptor set with

builder = builder.withGrid()...

and then defines corresponding parameters:

builder = builder.withGrid().withLevel(5).withBorder(Types.BorderTypes.TRAPEZOIDBOUNDARY)

Builder can automatically switches to the next state

builder.withGrid()...withCGSolver().withAccuracy(0.00000001)...

After all parameters are set you can return the constructed learning system with

builder.andGetResult()

The complete construction could look like following:

classifier = builder.buildClassifier()\
.withTrainingDataFromARFFFile("./datasets/classifier.train.arff")\
.withTestingDataFromARFFFile("./datasets/classifier.test.arff")\
.withGrid().withLevel(2)\
.withSpecification().withLambda(0.00001).withAdaptPoints(2)\
.withStopPolicy().withAdaptiveIterationLimit(1)\
.withCGSolver().withImax(500)\
.withProgressPresenter(InfoToFile("./presentor.test"))\
.andGetResult()

Parameters and where I can set them?

Constructor & Destructor Documentation

◆ __init__()

python.learner.LearnerBuilder.LearnerBuilder.__init__ (   self)

Default constuctor.

References python.learner.LearnerBuilder.LearnerBuilder.__gridDescriptor, python.uq.sampler.asgc.ASGCSamplerBuilder.ASGCSamplerBuilder.__gridDescriptor, python.learner.LearnerBuilder.LearnerBuilder.__learner, python.learner.LearnerBuilder.LearnerBuilder.__specificationDescriptor, python.learner.LearnerBuilder.LearnerBuilder.__stopPolicyDescriptor, python.uq.learner.builder.RegressorSpecificationDescriptor.RegressorSpecificationDescriptor.__stopPolicyDescriptor, and python.uq.sampler.asgc.ASGCSamplerBuilder.ASGCSamplerBuilder.__stopPolicyDescriptor.

Member Function Documentation

◆ andGetResult()

python.learner.LearnerBuilder.LearnerBuilder.andGetResult (   self)

Returns the builded learner (regressor or classifier), should be called at the end of construction.

Returns
: Learner (Classifier of Regressor)

References python.learner.LearnerBuilder.LearnerBuilder.__gridDescriptor, python.uq.sampler.asgc.ASGCSamplerBuilder.ASGCSamplerBuilder.__gridDescriptor, python.learner.LearnerBuilder.LearnerBuilder.__learner, and python.learner.LearnerBuilder.LearnerBuilder.__specificationDescriptor.

◆ buildClassifier()

python.learner.LearnerBuilder.LearnerBuilder.buildClassifier (   self)

Start building Classifier.

Returns
: LearnerBuilder itself

References python.learner.LearnerBuilder.LearnerBuilder.__buildCommonLearner(), and python.learner.LearnerBuilder.LearnerBuilder.__learner.

◆ buildRegressor()

python.learner.LearnerBuilder.LearnerBuilder.buildRegressor (   self)

Start building Regressor.

Returns
: LearnerBuilder itself

References python.learner.LearnerBuilder.LearnerBuilder.__buildCommonLearner(), and python.learner.LearnerBuilder.LearnerBuilder.__learner.

◆ getCheckpointController()

python.learner.LearnerBuilder.LearnerBuilder.getCheckpointController (   self)

Returns the checkpoint controller.

Returns
the checkpoint controller

References python.learner.LearnerBuilder.LearnerBuilder.__checkpointController.

◆ getLearner()

python.learner.LearnerBuilder.LearnerBuilder.getLearner (   self)

◆ withCGSolver()

python.learner.LearnerBuilder.LearnerBuilder.withCGSolver (   self)

Start description of parameters of CG-Solver for learner.

Returns
: CGSolverDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__solverDescriptor, and python.uq.learner.builder.RegressorSpecificationDescriptor.RegressorSpecificationDescriptor.__solverDescriptor.

◆ withCheckpointController()

python.learner.LearnerBuilder.LearnerBuilder.withCheckpointController (   self,
  controller 
)

Attaches checkpoint controller to the learner.

Parameters
controllerCheckpoint controller which implements LearnerEventController
Returns
: LearnerBuilder

References python.learner.LearnerBuilder.LearnerBuilder.__checkpointController, and python.learner.LearnerBuilder.LearnerBuilder.__learner.

◆ withFilesFoldingPolicy()

python.learner.LearnerBuilder.LearnerBuilder.withFilesFoldingPolicy (   self)

Signals to use N-fold cross validation from a set of files.

Returns
: FoldingDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__foldingPolicyDescriptor, and python.uq.learner.builder.RegressorSpecificationDescriptor.RegressorSpecificationDescriptor.__foldingPolicyDescriptor.

◆ withGrid()

python.learner.LearnerBuilder.LearnerBuilder.withGrid (   self)

Start description of parameters of CG-Solver for learner.

Returns
: GridDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__gridDescriptor, and python.uq.sampler.asgc.ASGCSamplerBuilder.ASGCSamplerBuilder.__gridDescriptor.

◆ withInitialAlphaFromARFFFile()

python.learner.LearnerBuilder.LearnerBuilder.withInitialAlphaFromARFFFile (   self,
  filename 
)

Signals to use initial data for alpha vector from ARFF file.

Parameters
filenameFilename where to read the data from
Returns
: LearnerBuilder object itself

References python.learner.LearnerBuilder.LearnerBuilder.__learner.

◆ withProgressPresenter()

python.learner.LearnerBuilder.LearnerBuilder.withProgressPresenter (   self,
  presentor 
)

Attaches progress presentor to the learner.

Parameters
presentorprogress presentor which implements LearnerEventController
Returns
: LearnerBuilder

References python.learner.LearnerBuilder.LearnerBuilder.__learner.

◆ withRandomFoldingPolicy()

python.learner.LearnerBuilder.LearnerBuilder.withRandomFoldingPolicy (   self)

Signals to use N-fold cross validation with random folding rule.

Returns
: FoldingDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__foldingPolicyDescriptor, and python.uq.learner.builder.RegressorSpecificationDescriptor.RegressorSpecificationDescriptor.__foldingPolicyDescriptor.

◆ withSequentialFoldingPolicy()

python.learner.LearnerBuilder.LearnerBuilder.withSequentialFoldingPolicy (   self)

Signals to use N-fold cross validation with sequential folding rule.

Returns
: FoldingDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__foldingPolicyDescriptor, and python.uq.learner.builder.RegressorSpecificationDescriptor.RegressorSpecificationDescriptor.__foldingPolicyDescriptor.

◆ withSpecification()

python.learner.LearnerBuilder.LearnerBuilder.withSpecification (   self)

Start description of specification parameters for learner.

Returns
: SpecificationDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__specificationDescriptor.

◆ withStartingIterationNumber()

python.learner.LearnerBuilder.LearnerBuilder.withStartingIterationNumber (   self,
  iteration 
)

Set the starting iteration number ane return the builder object.

Parameters
iterationinteger starting iteration number
Returns
: LeanreBuilder

References python.learner.LearnerBuilder.LearnerBuilder.__learner.

◆ withStopPolicy()

python.learner.LearnerBuilder.LearnerBuilder.withStopPolicy (   self)

Start description of parameters of stop-policy for learner.

Returns
: StopPolicyDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__stopPolicyDescriptor, python.uq.learner.builder.RegressorSpecificationDescriptor.RegressorSpecificationDescriptor.__stopPolicyDescriptor, and python.uq.sampler.asgc.ASGCSamplerBuilder.ASGCSamplerBuilder.__stopPolicyDescriptor.

Referenced by python.uq.learner.builder.RegressorSpecificationDescriptor.RegressorSpecificationDescriptor.create().

◆ withStratifiedFoldingPolicy()

python.learner.LearnerBuilder.LearnerBuilder.withStratifiedFoldingPolicy (   self)

Signals to use N-fold cross validation with stratified folding rule.

Returns
: FoldingDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__foldingPolicyDescriptor, and python.uq.learner.builder.RegressorSpecificationDescriptor.RegressorSpecificationDescriptor.__foldingPolicyDescriptor.

◆ withTestingDataFromARFFFile()

python.learner.LearnerBuilder.LearnerBuilder.withTestingDataFromARFFFile (   self,
  filename 
)

Signals to use data from ARFF file for testing dataset.

Parameters
filenameFilename where to read the data from
Returns
: LearnerBuilder object itself

References python.learner.LearnerBuilder.LearnerBuilder.__learner.

◆ withTestingDataFromCSVFile()

python.learner.LearnerBuilder.LearnerBuilder.withTestingDataFromCSVFile (   self,
  filename 
)

Signals to use data from CSV file for testing dataset.

Parameters
filenameFilename where to read the data from
Returns
: LearnerBuilder object itself

References python.learner.LearnerBuilder.LearnerBuilder.__learner.

◆ withTestingDataFromNumPyArray()

python.learner.LearnerBuilder.LearnerBuilder.withTestingDataFromNumPyArray (   self,
  points,
  values,
  name = "test" 
)

◆ withTrainingDataFromARFFFile()

python.learner.LearnerBuilder.LearnerBuilder.withTrainingDataFromARFFFile (   self,
  filename,
  name = "train" 
)

Signals to use data from ARFF file for training dataset.

Parameters
filenameFilename where to read the data from
nameCategory name, default: "train"
Returns
: LearnerBuilder

References python.learner.LearnerBuilder.LearnerBuilder.__learner.

◆ withTrainingDataFromCSVFile()

python.learner.LearnerBuilder.LearnerBuilder.withTrainingDataFromCSVFile (   self,
  filename,
  name = "train" 
)

Signals to use data from CSV file for training dataset.

Parameters
filenameFilename where to read the data from
nameCategory name, default: "train"
Returns
: LearnerBuilder

References python.learner.LearnerBuilder.LearnerBuilder.__learner.

◆ withTrainingDataFromNumPyArray()

python.learner.LearnerBuilder.LearnerBuilder.withTrainingDataFromNumPyArray (   self,
  points,
  values,
  name = "train" 
)

References python.learner.LearnerBuilder.LearnerBuilder.__learner.

Referenced by python.learner.LearnerBuilder.LearnerBuilder.withTestingDataFromNumPyArray().


The documentation for this class was generated from the following file: