All Downloads are FREE. Search and download functionalities are using the official Maven repository.

weka.classifiers.functions.loss.LossFunction Maven / Gradle / Ivy

Go to download

This package currently contains classes for training multilayer perceptrons with one hidden layer, where the number of hidden units is user specified. MLPClassifier can be used for classification problems and MLPRegressor is the corresponding class for numeric prediction tasks. The former has as many output units as there are classes, the latter only one output unit. Both minimise a penalised squared error with a quadratic penalty on the (non-bias) weights, i.e., they implement "weight decay", where this penalised error is averaged over all training instances. The size of the penalty can be determined by the user by modifying the "ridge" parameter to control overfitting. The sum of squared weights is multiplied by this parameter before added to the squared error. Both classes use BFGS optimisation by default to find parameters that correspond to a local minimum of the error function. but optionally conjugated gradient descent is available, which can be faster for problems with many parameters. Logistic functions are used as the activation functions for all units apart from the output unit in MLPRegressor, which employs the identity function. Input attributes are standardised to zero mean and unit variance. MLPRegressor also rescales the target attribute (i.e., "class") using standardisation. All network parameters are initialised with small normally distributed random values.

There is a newer version: 1.0.9
Show newest version
/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software
 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/*
 *    LossFunction.java
 *    Copyright (C) 2015 University of Waikato, Hamilton, New Zealand
 */

package weka.classifiers.functions.loss;

import java.io.Serializable;

/**
 * Interface implemented by loss functions for MLPRegressor and MLPClassifier.
 *
 * @author Eibe Frank ([email protected])
 * @version $Revision: 10949 $
 */
public interface LossFunction extends Serializable {

  /**
   * Returns the loss.
   * @param pred predicted target value
   * @param actual actual target value
   * @return the loss
   */
  double loss(double pred, double actual);

  /**
   * The derivative of the loss with respect to the predicted value
   * @param pred predicted target value
   * @param actual actual target value
   * @return the value of the derivative
   */
  double derivative(double pred, double actual);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy