SG++
python.uq.learner.builder.LearnerBuilder.LearnerBuilder Class Reference

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

Inheritance diagram for python.uq.learner.builder.LearnerBuilder.LearnerBuilder:

Public Member Functions

def __init__ (self)
 
def andGetResult (self)
 
def buildInterpolant (self)
 
def buildRegressor (self)
 
def getCheckpointController (self)
 
def getLearner (self)
 
def withCheckpointController (self, controller)
 

Detailed Description

Implement mechanisms to create customized learning system.

Usage examples

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

1 import pysgpp.extensions.datadriven.learner.LearnerBuilder as LearnerBuilder
2 builder = LearnerBuilder()
3 builder = builder.buildClassifier()

or regression

1 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

1 builder = builder.withGrid()...

and then defines corresponding parameters:

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

Builder can automatically switches to the next state

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

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

1 builder.andGetResult()

The complete construction could look like following:

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

Constructor & Destructor Documentation

def python.uq.learner.builder.LearnerBuilder.LearnerBuilder.__init__ (   self)
Constructor

References python.uq.learner.builder.LearnerBuilder.LearnerBuilder._checkpointController, python.uq.learner.builder.LearnerBuilder.LearnerBuilder._gridDescriptor, python.uq.learner.builder.LearnerBuilder.LearnerBuilder._learner, python.uq.learner.builder.LearnerBuilder.LearnerBuilder._specificationDescriptor, and python.uq.learner.builder.LearnerBuilder.LearnerBuilder._stopPolicyDescriptor.

Member Function Documentation

def python.uq.learner.builder.LearnerBuilder.LearnerBuilder.andGetResult (   self)
Returns the builded learner (regressor or interpolant),
should be called in the and of construction

References python.uq.learner.builder.LearnerBuilder.LearnerBuilder._gridDescriptor, and python.uq.learner.builder.LearnerBuilder.LearnerBuilder._learner.

def python.uq.learner.builder.LearnerBuilder.LearnerBuilder.buildInterpolant (   self)

References python.uq.learner.builder.LearnerBuilder.LearnerBuilder._learner, and python.uq.learner.builder.LearnerBuilder.LearnerBuilder._specificationDescriptor.

def python.uq.learner.builder.LearnerBuilder.LearnerBuilder.buildRegressor (   self)
Start building regressor

References python.uq.learner.builder.LearnerBuilder.LearnerBuilder._learner, and python.uq.learner.builder.LearnerBuilder.LearnerBuilder._specificationDescriptor.

def python.uq.learner.builder.LearnerBuilder.LearnerBuilder.getCheckpointController (   self)
Returns the checkpoint controller

References python.uq.learner.builder.LearnerBuilder.LearnerBuilder._checkpointController.

def python.uq.learner.builder.LearnerBuilder.LearnerBuilder.getLearner (   self)
Returns the object of learner subclass, that is currently beeing
constructed

References python.uq.learner.builder.LearnerBuilder.LearnerBuilder._learner.

def python.uq.learner.builder.LearnerBuilder.LearnerBuilder.withCheckpointController (   self,
  controller 
)
Attaches checkpoint controller to the learner
@param controller: Checkpoint controller which implements
LearnerEventController

References python.uq.learner.builder.LearnerBuilder.LearnerBuilder._checkpointController, and python.uq.learner.builder.LearnerBuilder.LearnerBuilder._learner.


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