Esempio n. 1
0
void SOGP::init(unsigned int state_dim, unsigned int output_dim,
                Kernel &kernel,
                double noise,
                double epsilon,
                unsigned int capacity,
                int problem_type,
                int deletion_criteria
                ) {

    this->kernel = kernel.createCopy();
    this->state_dim = state_dim;
    this->output_dim = output_dim;
    this->noise = noise;
    this->epsilon = epsilon;
    this->capacity = capacity;
    this->current_size = 0;

    this->problem_type = problem_type;
    this->deletion_criteria = deletion_criteria;

    if ((this->problem_type != SOGP::CLASSIFICATION) && (this->problem_type != SOGP::REGRESSION)) {
        throw OTL::OTLException("The problem has to be of SOGP::CLASSIFICATION or SOGP::REGRESSION");
    }

    if ((this->deletion_criteria != SOGP::NORM) && (this->deletion_criteria != SOGP::MINIMAX)) {
        throw OTL::OTLException("The deletion criteria has to be either SOGP::NORM or SOGP::MINIMAX");
    }

    if (this->problem_type == SOGP::CLASSIFICATION) {
        if (this->output_dim < 1) {
            throw OTL::OTLException("You need at least one class for classification");
        }
    }

    //initialise the matrices : not that the capacity is +1 since
    //we allow it to grow one more before reducing.
    this->alpha = MatrixXd::Zero(this->capacity+1, this->output_dim);
    this->C = MatrixXd::Zero(this->capacity+1, this->capacity+1);
    this->Q = MatrixXd::Zero(this->capacity+1, this->capacity+1);

    this->initialized = true;
}