SG++-Doxygen-Documentation
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

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

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

Default constuctor.

References python.learner.LearnerBuilder.LearnerBuilder.__gridDescriptor, python.learner.LearnerBuilder.LearnerBuilder.__learner, python.learner.LearnerBuilder.LearnerBuilder.__specificationDescriptor, and python.learner.LearnerBuilder.LearnerBuilder.__stopPolicyDescriptor.

Member Function Documentation

◆ andGetResult()

def 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.learner.LearnerBuilder.LearnerBuilder.__learner, python.learner.LearnerBuilder.LearnerBuilder.__specificationDescriptor, and sgpp::op_factory.createOperationMultipleEval().

◆ buildClassifier()

def 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()

def 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()

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

Returns the checkpoint controller.

Returns
the checkpoint controller

References python.learner.LearnerBuilder.LearnerBuilder.__checkpointController.

◆ getLearner()

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

◆ withCGSolver()

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

Start description of parameters of CG-Solver for learner.

Returns
: CGSolverDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__solverDescriptor.

◆ withCheckpointController()

def 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()

def 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.

◆ withGrid()

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

Start description of parameters of CG-Solver for learner.

Returns
: GridDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__gridDescriptor.

◆ withInitialAlphaFromARFFFile()

def 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()

def 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()

def 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.

◆ withSequentialFoldingPolicy()

def 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.

◆ withSpecification()

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

Start description of specification parameters for learner.

Returns
: SpecificationDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__specificationDescriptor.

◆ withStartingIterationNumber()

def 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()

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

Start description of parameters of stop-policy for learner.

Returns
: StopPolicyDescriptor

References python.learner.LearnerBuilder.LearnerBuilder.__stopPolicyDescriptor.

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

◆ withStratifiedFoldingPolicy()

def 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.

◆ withTestingDataFromARFFFile()

def 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()

def 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()

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

◆ withTrainingDataFromARFFFile()

def 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()

def 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()

def 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: