org.opentox.algorithm.trainer
Class MlrTrainer

java.lang.Object
  extended by org.opentox.error.ErrorSource
      extended by org.opentox.algorithm.trainer.AbstractTrainer
          extended by org.opentox.algorithm.trainer.MlrTrainer
All Implemented Interfaces:
IProne2Error, ITrainer

public class MlrTrainer
extends AbstractTrainer

Trainer for MLR models.

Version:
1.3.3 (Last update: Dec 20, 2009)
Author:
OpenTox - http://www.opentox.org/, Sopasakis Pantelis, Sarimveis Harry

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opentox.algorithm.trainer.AbstractTrainer
AbstractTrainer.Classification, AbstractTrainer.Regression
 
Field Summary
protected  weka.core.Instances data
           
 
Fields inherited from class org.opentox.algorithm.trainer.AbstractTrainer
dataseturi, form, resource, targeturi
 
Fields inherited from class org.opentox.error.ErrorSource
errorRep
 
Constructor Summary
MlrTrainer(org.restlet.data.Form form, org.restlet.resource.ServerResource resource)
           
 
Method Summary
 ErrorRepresentation checkParameters()
          Check wether the dataset and target values are valid URIs.
private  void generatePMML(double[] coefficients, int model_id)
          Generates the PMML representation of the model and stores in the hard disk.
 org.restlet.representation.Representation train()
          Returns an ErrorRepresentation if something goes wrong or a StringRepresentation with the URI of the created model, if the model is successfully created.
 
Methods inherited from class org.opentox.error.ErrorSource
getErrorRep
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opentox.interfaces.IProne2Error
getErrorRep
 

Field Detail

data

protected weka.core.Instances data
Constructor Detail

MlrTrainer

public MlrTrainer(org.restlet.data.Form form,
                  org.restlet.resource.ServerResource resource)
Method Detail

train

public org.restlet.representation.Representation train()
Returns an ErrorRepresentation if something goes wrong or a StringRepresentation with the URI of the created model, if the model is successfully created.

Returns:
representation of the training result.

checkParameters

public ErrorRepresentation checkParameters()
Check wether the dataset and target values are valid URIs.

Returns:
Returns an empty ErrorRepresentation if no error is found (the posted parameters are acceptable), otherwise a representation of the error. The internal status is defined accordingly.

generatePMML

private void generatePMML(double[] coefficients,
                          int model_id)
Generates the PMML representation of the model and stores in the hard disk.

Parameters:
coefficients - The vector of the coefficients of the MLR model.
model_id - The id of the generated model.