gov.sandia.cognition.learning.algorithm.baseline.IdentityLearner 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: IdentityLearner.java
* Authors: Justin Basilico
* Project: Cognitive Foundry Learning Core
*
* Copyright 2011 Cognitive Foundry. All rights reserved.
*/
package gov.sandia.cognition.learning.algorithm.baseline;
import gov.sandia.cognition.learning.algorithm.BatchLearner;
import gov.sandia.cognition.util.AbstractCloneableSerializable;
/**
* A batch learner implementation that just returns its inputs, creating an
* identity function.
*
* @param
* The type of value passed into and out of the learner.
* @author Justin Basilico
* @since 3.3.3
*/
public class IdentityLearner
extends AbstractCloneableSerializable
implements BatchLearner
{
/**
* Creates a new {@code IdentityLearner}, which has no parameters.
*/
public IdentityLearner()
{
super();
}
@Override
public IdentityLearner clone()
{
@SuppressWarnings("unchecked")
final IdentityLearner clone = (IdentityLearner)
super.clone();
return clone;
}
@Override
public ValueType learn(
final ValueType data)
{
return data;
}
/**
* A convenience method for creating a {@code IdentityLearner}.
*
* @param
* The type of value passed into and out of the learner.
* @return
* A new learner.
*/
public static IdentityLearner create()
{
return new IdentityLearner();
}
}