com.asher_stern.crf.function.optimization.ConstantLineSearch Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of CRF Show documentation
Show all versions of CRF Show documentation
Implementation of linear-chain Conditional Random Fields (CRF) in pure Java
The newest version!
package com.asher_stern.crf.function.optimization;
import java.math.BigDecimal;
import com.asher_stern.crf.function.Function;
import com.asher_stern.crf.utilities.ArithmeticUtilities;
/**
* A simple inexact and inaccurate non-efficient line search which merely returns a small
* constant for any input.
*
* @author Asher Stern
* Date: Nov 7, 2014
*
*/
public class ConstantLineSearch implements LineSearch
{
public static final BigDecimal DEFAULT_RATE = new BigDecimal(0.01, ArithmeticUtilities.MC);
public ConstantLineSearch()
{
this(DEFAULT_RATE);
}
public ConstantLineSearch(BigDecimal constantRate)
{
super();
this.constantRate = constantRate;
}
@Override
public BigDecimal findRate(F function, BigDecimal[] point, BigDecimal[] direction)
{
return constantRate;
}
private final BigDecimal constantRate;
}