SG++-Doxygen-Documentation
|
Implement mechanisms to create customized learning system. More...
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") |
Implement mechanisms to create customized learning system.
To create a learning system first define if it should be for classification
or regression
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
and then defines corresponding parameters:
Builder can automatically switches to the next state
After all parameters are set you can return the constructed learning system with
The complete construction could look like following:
level
: Gridlevel - withGrid().withLevel(2)
dim
: Griddimension - Dimension is identified from the data set (by calling .withTrainingDataFromARFFFile(...)
) adaptive
: Using an adaptive Grid with NUM of refines - .withStopPolicy().withAdaptiveIterationLimit(10)
adapt_points
: Number of points in one refinement iteration - .withSpecification().withAdaptPoints(100)
adapt_rate
: Percentage of points from all refinable points in one refinement iteration - .withSpecification().withAdaptRate(0.05)
adapt_start
: The index of adapt step to begin with - Is know handled by loading the learner with specified iteration level from CheckpointController using checkpointController.loadAll(10)
adapt_threshold
: refinement threshold - .withSpecification().withAdaptThreshold(0.003) mode
: Specifies the action to do - Call corresponding method, i.e. applyData, learnData, learnDataWithTest, learnDataWithFolding zeh
: Specifies the action to do - .withSpecification().withIdentityOperator() or .withSpecification().withLaplaceOperator() foldlevel
: specifies the number of sets generated - Is set in FoldingDescriptor: builder.withSequentialFoldingPolicy().withLevel(level)
onlyfoldnum
: Run only fold I in n-fold cross-validation. Default: run all - checkpointController.generateFoldValidationJob() generates a set of independent learners and a job script to run as SGE job array. In this way all or individual jobs can be ran either with SGE jobs or in console. lambda
: Lambda - .withSpecification().withLambda(0.00001) imax
: Max number of iterations - .withCGSolver().withImax(500) accuracy
: Specifies the accuracy of the CG-Iteration - .withCGSolver().withAccuracy(0.0001) max_accuracy
: If the norm of the residuum falls below ACCURACY, stop the CG iterations - .withCGSolver().withThreshold(0.0000000001) data
: Filename for the Datafile. - .withTestingDataFromARFFFile("./datasets/classifier.test.arff") test
: File containing the testdata - .withTestingDataFromARFFFile("./datasets/classifier.test.arff") alpha
: Filename for a file containing an alpha-Vector - learner = builder.andGetResult()
learner.knowledge = LearnedKnowledgeFileAdapter().load("./alphas.arff")
outfile
: Filename where the calculated alphas are stored - .withProgressPresenter(InfoToFile("./presentor.test"))
gnuplot
: In 2D case, the generated can be stored in a gnuplot readable format - Some Graphs can now be plotted with InfoToGraph resolution
: Specifies the resolution of the gnuplotfile - Not used, as gnuplot
is not yet implemented stats
: In this file the statistics from the test are stored - Can be implemented as subclass from LearnerEventController polynom
: Sets the maximum degree for basis functions - .withGrid().withPolynomialBase(2) border
Enables special border base functions - .withGrid().withBorder(Types.BorderTypes.TRAPEZOIDBOUNDARY) trapezoid-boundary
Enables boundary functions that have a point on the boundary for every inner point (Trapezoid) - .withGrid().withBorder(Types.BorderTypes.TRAPEZOIDBOUNDARY) complete-boundary
Enables boundary functions that have more points on the boundary than inner points - .withGrid().withBorder(Types.BorderTypes.COMPLETEBOUNDARY) verbose
: Provides extra output - Set the suitable LearnerEventController implementation, i.e. .withProgressPresenter(InfoToScreen())
normfile
: For all modes that read data via stdin. Normalizes data according to boundaries in FILE - Can be implemented as subclass of ARFFAdapter
reuse
: Reuse alpha-values for CG - .withCGSolver().withAlphaReusing()
seed
: Random seed used for initializing Is set in FoldingDescriptor: builder.withRandomFoldingPolicy().withSeed(level)
regression
: Use regression approach - builder.buildRegressor()
checkpoint
: Filename for checkpointing - controller = CheckpointController("classification_job") builder.withCheckpointController(controller)
grid
: Filename for Grid-resume - .withGrid.fromFile("gridfile.gz")
epochs_limit
: Number of refinement iterations (epochs), MSE of test data have to increase, before refinement will stop - .withStopPolicy().withEpochsLimit(20)
mse_limit
If MSE of test data fall below this limit, refinement will stop - .withStopPolicy().withMSELimit(0.0003)
, also ..withStopPolicy().withAccuracyLimit(0.95)
for classification accuracy grid_limit
If the number of points on grid exceed grid_limit, refinement will stop - .withStopPolicy().withGridSizeLimit(40000)
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.
def python.learner.LearnerBuilder.LearnerBuilder.andGetResult | ( | self | ) |
Returns the builded learner (regressor or classifier), should be called at the end of construction.
References python.learner.LearnerBuilder.LearnerBuilder.__gridDescriptor, python.learner.LearnerBuilder.LearnerBuilder.__learner, python.learner.LearnerBuilder.LearnerBuilder.__specificationDescriptor, and sgpp::op_factory.createOperationMultipleEval().
def python.learner.LearnerBuilder.LearnerBuilder.buildClassifier | ( | self | ) |
Start building Classifier.
References python.learner.LearnerBuilder.LearnerBuilder.__buildCommonLearner(), and python.learner.LearnerBuilder.LearnerBuilder.__learner.
def python.learner.LearnerBuilder.LearnerBuilder.buildRegressor | ( | self | ) |
Start building Regressor.
References python.learner.LearnerBuilder.LearnerBuilder.__buildCommonLearner(), and python.learner.LearnerBuilder.LearnerBuilder.__learner.
def python.learner.LearnerBuilder.LearnerBuilder.getCheckpointController | ( | self | ) |
Returns the checkpoint controller.
References python.learner.LearnerBuilder.LearnerBuilder.__checkpointController.
def python.learner.LearnerBuilder.LearnerBuilder.getLearner | ( | self | ) |
Returns the object of learner subclass, that is currently beeing constructed.
References python.learner.LearnerBuilder.LearnerBuilder.__learner.
Referenced by python.learner.LearnerBuilder.LearnerBuilder.GridDescriptor.__getattr__(), python.learner.LearnerBuilder.LearnerBuilder.StopPolicyDescriptor.__getattr__(), python.learner.LearnerBuilder.LearnerBuilder.SpecificationDescriptor.__getattr__(), python.learner.LearnerBuilder.LearnerBuilder.CGSolverDescriptor.__getattr__(), python.learner.LearnerBuilder.LearnerBuilder.FoldingDescriptor.__getattr__(), and python.learner.LearnerBuilder.LearnerBuilder.GridDescriptor.__init__().
def python.learner.LearnerBuilder.LearnerBuilder.withCGSolver | ( | self | ) |
Start description of parameters of CG-Solver for learner.
References python.learner.LearnerBuilder.LearnerBuilder.__solverDescriptor.
def python.learner.LearnerBuilder.LearnerBuilder.withCheckpointController | ( | self, | |
controller | |||
) |
Attaches checkpoint controller to the learner.
controller | Checkpoint controller which implements LearnerEventController |
References python.learner.LearnerBuilder.LearnerBuilder.__checkpointController, and python.learner.LearnerBuilder.LearnerBuilder.__learner.
def python.learner.LearnerBuilder.LearnerBuilder.withFilesFoldingPolicy | ( | self | ) |
Signals to use N-fold cross validation from a set of files.
References python.learner.LearnerBuilder.LearnerBuilder.__foldingPolicyDescriptor.
def python.learner.LearnerBuilder.LearnerBuilder.withGrid | ( | self | ) |
Start description of parameters of CG-Solver for learner.
References python.learner.LearnerBuilder.LearnerBuilder.__gridDescriptor.
def python.learner.LearnerBuilder.LearnerBuilder.withInitialAlphaFromARFFFile | ( | self, | |
filename | |||
) |
Signals to use initial data for alpha vector from ARFF file.
filename | Filename where to read the data from |
References python.learner.LearnerBuilder.LearnerBuilder.__learner.
def python.learner.LearnerBuilder.LearnerBuilder.withProgressPresenter | ( | self, | |
presentor | |||
) |
Attaches progress presentor to the learner.
presentor | progress presentor which implements LearnerEventController |
References python.learner.LearnerBuilder.LearnerBuilder.__learner.
def python.learner.LearnerBuilder.LearnerBuilder.withRandomFoldingPolicy | ( | self | ) |
Signals to use N-fold cross validation with random folding rule.
References python.learner.LearnerBuilder.LearnerBuilder.__foldingPolicyDescriptor.
def python.learner.LearnerBuilder.LearnerBuilder.withSequentialFoldingPolicy | ( | self | ) |
Signals to use N-fold cross validation with sequential folding rule.
References python.learner.LearnerBuilder.LearnerBuilder.__foldingPolicyDescriptor.
def python.learner.LearnerBuilder.LearnerBuilder.withSpecification | ( | self | ) |
Start description of specification parameters for learner.
References python.learner.LearnerBuilder.LearnerBuilder.__specificationDescriptor.
def python.learner.LearnerBuilder.LearnerBuilder.withStartingIterationNumber | ( | self, | |
iteration | |||
) |
Set the starting iteration number ane return the builder object.
iteration | integer starting iteration number |
References python.learner.LearnerBuilder.LearnerBuilder.__learner.
def python.learner.LearnerBuilder.LearnerBuilder.withStopPolicy | ( | self | ) |
Start description of parameters of stop-policy for learner.
References python.learner.LearnerBuilder.LearnerBuilder.__stopPolicyDescriptor.
Referenced by python.uq.learner.builder.RegressorSpecificationDescriptor.RegressorSpecificationDescriptor.create().
def python.learner.LearnerBuilder.LearnerBuilder.withStratifiedFoldingPolicy | ( | self | ) |
Signals to use N-fold cross validation with stratified folding rule.
References python.learner.LearnerBuilder.LearnerBuilder.__foldingPolicyDescriptor.
def python.learner.LearnerBuilder.LearnerBuilder.withTestingDataFromARFFFile | ( | self, | |
filename | |||
) |
Signals to use data from ARFF file for testing dataset.
filename | Filename where to read the data from |
References python.learner.LearnerBuilder.LearnerBuilder.__learner.
def python.learner.LearnerBuilder.LearnerBuilder.withTestingDataFromCSVFile | ( | self, | |
filename | |||
) |
Signals to use data from CSV file for testing dataset.
filename | Filename where to read the data from |
References python.learner.LearnerBuilder.LearnerBuilder.__learner.
def python.learner.LearnerBuilder.LearnerBuilder.withTestingDataFromNumPyArray | ( | self, | |
points, | |||
values, | |||
name = "test" |
|||
) |
def python.learner.LearnerBuilder.LearnerBuilder.withTrainingDataFromARFFFile | ( | self, | |
filename, | |||
name = "train" |
|||
) |
Signals to use data from ARFF file for training dataset.
filename | Filename where to read the data from |
name | Category name, default: "train" |
References python.learner.LearnerBuilder.LearnerBuilder.__learner.
def python.learner.LearnerBuilder.LearnerBuilder.withTrainingDataFromCSVFile | ( | self, | |
filename, | |||
name = "train" |
|||
) |
Signals to use data from CSV file for training dataset.
filename | Filename where to read the data from |
name | Category name, default: "train" |
References python.learner.LearnerBuilder.LearnerBuilder.__learner.
def python.learner.LearnerBuilder.LearnerBuilder.withTrainingDataFromNumPyArray | ( | self, | |
points, | |||
values, | |||
name = "train" |
|||
) |
References python.learner.LearnerBuilder.LearnerBuilder.__learner.
Referenced by python.learner.LearnerBuilder.LearnerBuilder.withTestingDataFromNumPyArray().