Example usage for weka.core Optimization getVarbValues

List of usage examples for weka.core Optimization getVarbValues

Introduction

In this page you can find the example usage for weka.core Optimization getVarbValues.

Prototype

public double[] getVarbValues() 

Source Link

Document

Get the variable values.

Usage

From source file:br.com.ufu.lsi.rebfnetwork.RBFModel.java

License:Open Source License

/**
 * Builds the RBF network regressor based on the given dataset.
 *///from w ww  .  j a  va 2  s  .  c o  m
public void buildClassifier(Instances data) throws Exception {

    // Set up the initial arrays
    m_data = initializeClassifier(data);

    if (m_ZeroR != null) {
        return;
    }

    // Initialise thread pool
    m_Pool = Executors.newFixedThreadPool(m_poolSize);

    // Apply optimization class to train the network
    Optimization opt = null;
    if (!m_useCGD) {
        opt = new OptEng();
    } else {
        opt = new OptEngCGD();
    }
    opt.setDebug(m_Debug);

    // No constraints
    double[][] b = new double[2][m_RBFParameters.length];
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < m_RBFParameters.length; j++) {
            b[i][j] = Double.NaN;
        }
    }

    m_RBFParameters = opt.findArgmin(m_RBFParameters, b);
    while (m_RBFParameters == null) {
        m_RBFParameters = opt.getVarbValues();
        if (m_Debug) {
            System.out.println("200 iterations finished, not enough!");
        }
        m_RBFParameters = opt.findArgmin(m_RBFParameters, b);
    }
    if (m_Debug) {
        System.out.println("SE (normalized space) after optimization: " + opt.getMinFunction());
    }

    m_data = new Instances(m_data, 0); // Save memory

    // Shut down thread pool
    m_Pool.shutdown();
}