Top Description Inners Fields Constructors Methods
org.apache.commons.math3.analysis.function

public Class Sigmoid

extends Object
implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.analysis.DifferentiableUnivariateFunction, org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction
Imports
java.util.Arrays, org.apache.commons.math3.analysis.FunctionUtils, .UnivariateFunction, .DifferentiableUnivariateFunction, .ParametricUnivariateFunction, org.apache.commons.math3.analysis.differentiation.DerivativeStructure, .UnivariateDifferentiableFunction, org.apache.commons.math3.exception.NullArgumentException, .DimensionMismatchException, org.apache.commons.math3.util.FastMath

Deprecated

as a consequence of DifferentiableUnivariateFunction being deprecated. See corresponding docs for further information.

Sigmoid function. It is the inverse of the logit function. A more flexible version, the generalised logistic, is implemented by the Logistic class.
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Sigmoid.Parametric

Parametric function where the input array contains the parameters of the sigmoid function, ordered as follows:

  • Lower asymptote
  • Higher asymptote

Field Summary

Modifier and TypeField and Description
private final double
hi

Higher asymptote.

private final double
lo

Lower asymptote.

Constructor Summary

AccessConstructor and Description
public
Sigmoid()

Usual sigmoid function, where the lower asymptote is 0 and the higher asymptote is 1.

public
Sigmoid(double
Lower asymptote.
lo
,
double
Higher asymptote.
hi
)

Sigmoid function.

Method Summary

Modifier and TypeMethod and Description
public UnivariateFunction
derivative()

Implements org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Deprecated as of 3.1, replaced by value(DerivativeStructure)

Returns the derivative of the function

public double
value(double
Point at which the function value should be computed.
x
)

Implements org.apache.commons.math3.analysis.UnivariateFunction.value.

Compute the value of the function.

private static double

Returns:

the value of the sigmoid function at x.
value
(double
Value at which to compute the sigmoid.
x
,
double
Lower asymptote.
lo
,
double
Higher asymptote.
hi
)

public DerivativeStructure
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hiback to summary
private final double hi

Higher asymptote.

loback to summary
private final double lo

Lower asymptote.

Constructor Detail

Sigmoidback to summary
public Sigmoid()

Usual sigmoid function, where the lower asymptote is 0 and the higher asymptote is 1.

Sigmoidback to summary
public Sigmoid(double lo, double hi)

Sigmoid function.

Parameters
lo:double

Lower asymptote.

hi:double

Higher asymptote.

Method Detail

derivativeback to summary
public UnivariateFunction derivative()

Implements org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Doc from org.apache.commons.math3.analysis.DifferentiableUnivariateFunction.derivative.

Deprecated

as of 3.1, replaced by value(DerivativeStructure)

Returns the derivative of the function

Returns:UnivariateFunction

the derivative function

Annotations
@Deprecated
valueback to summary
public double value(double x)

Implements org.apache.commons.math3.analysis.UnivariateFunction.value.

Doc from org.apache.commons.math3.analysis.UnivariateFunction.value.

Compute the value of the function.

Parameters
x:double

Point at which the function value should be computed.

Returns:double

the value of the function.

valueback to summary
private static double value(double x, double lo, double hi)
Parameters
x:double

Value at which to compute the sigmoid.

lo:double

Lower asymptote.

hi:double

Higher asymptote.

Returns:double

the value of the sigmoid function at x.

valueback to summary
public DerivativeStructure value(final DerivativeStructure t) throws DimensionMismatchException

Implements org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction.value.

Doc from org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction.value.

Simple mathematical function.

UnivariateDifferentiableFunction classes compute both the value and the first derivative of the function.

Parameters
t:DerivativeStructure

function input value

Returns:DerivativeStructure

function result

Exceptions
DimensionMismatchException:
if t is inconsistent with the function's free parameters or order
Since
3.1
org.apache.commons.math3.analysis.function back to summary

public Class Sigmoid.Parametric

extends Object
implements ParametricUnivariateFunction
Class Inheritance
  • java.lang.Object
  • org.apache.commons.math3.analysis.function.Sigmoid.Parametric
All Implemented Interfaces
org.apache.commons.math3.analysis.ParametricUnivariateFunction

Parametric function where the input array contains the parameters of the sigmoid function, ordered as follows:

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public double[]

Returns:

the gradient vector at x.
gradient
(double
Value at which the gradient must be computed.
x
,
double...
Values for lower asymptote and higher asymptote.
param
)

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.gradient.

Computes the value of the gradient at x.

private void
validateParameters(double[]
Values for lower and higher asymptotes.
param
)

Validates parameters to ensure they are appropriate for the evaluation of the value(double, double[]) and gradient(double, double[]) methods.

public double

Returns:

the value of the function.
value
(double
Value for which the function must be computed.
x
,
double...
Values of lower asymptote and higher asymptote.
param
)

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.value.

Computes the value of the sigmoid at x.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Parametricback to summary
public Parametric()

Method Detail

gradientback to summary
public double[] gradient(double x, double... param) throws NullArgumentException, DimensionMismatchException

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.gradient.

Computes the value of the gradient at x. The components of the gradient vector are the partial derivatives of the function with respect to each of the parameters (lower asymptote and higher asymptote).

Parameters
x:double

Value at which the gradient must be computed.

param:double[]

Values for lower asymptote and higher asymptote.

Returns:double[]

the gradient vector at x.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 2.
validateParametersback to summary
private void validateParameters(double[] param) throws NullArgumentException, DimensionMismatchException

Validates parameters to ensure they are appropriate for the evaluation of the value(double, double[]) and gradient(double, double[]) methods.

Parameters
param:double[]

Values for lower and higher asymptotes.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 2.
valueback to summary
public double value(double x, double... param) throws NullArgumentException, DimensionMismatchException

Implements org.apache.commons.math3.analysis.ParametricUnivariateFunction.value.

Computes the value of the sigmoid at x.

Parameters
x:double

Value for which the function must be computed.

param:double[]

Values of lower asymptote and higher asymptote.

Returns:double

the value of the function.

Exceptions
NullArgumentException:
if param is null.
DimensionMismatchException:
if the size of param is not 2.