gov.sandia.cognition.learning.function.cost.AbstractCostFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cognitive-foundry Show documentation
Show all versions of cognitive-foundry Show documentation
A single jar with all the Cognitive Foundry components.
/*
* File: AbstractCostFunction.java
* Authors: Kevin R. Dixon
* Company: Sandia National Laboratories
* Project: Cognitive Foundry
*
* Copyright Jul 9, 2010, Sandia Corporation.
* Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
* license for use of this work by or on behalf of the U.S. Government.
* Export of this program may require a license from the United States
* Government. See CopyrightHistory.txt for complete details.
*
*/
package gov.sandia.cognition.learning.function.cost;
import gov.sandia.cognition.util.AbstractCloneableSerializable;
import gov.sandia.cognition.util.ObjectUtil;
/**
* Partial implementation of CostFunction.
* @param
* Class type to evaluate, for example a "Vector" or "Evaluator"
* @param
* Class type that parameterizes the CostFunction, for example, a Collection of
* InputOutputPairs. Usually the dataset we're interested in.
* @author Kevin R. Dixon
* @since 3.1
*/
public abstract class AbstractCostFunction
extends AbstractCloneableSerializable
implements CostFunction
{
/**
* The parameters of the cost function.
*/
protected CostParametersType costParameters;
/**
* Creates a new instance of AbstractCostFunction
*/
public AbstractCostFunction()
{
this( null );
}
/**
* Creates a new instance of AbstractCostFunction
* @param costParameters The parameters of the cost function.
*/
public AbstractCostFunction(
CostParametersType costParameters)
{
this.setCostParameters(costParameters);
}
@Override
@SuppressWarnings("unchecked")
public AbstractCostFunction clone()
{
AbstractCostFunction clone =
(AbstractCostFunction) super.clone();
clone.setCostParameters(
ObjectUtil.cloneSmart( this.getCostParameters() ) );
return clone;
}
public void setCostParameters(
CostParametersType costParameters)
{
this.costParameters = costParameters;
}
public CostParametersType getCostParameters()
{
return this.costParameters;
}
}