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

gov.sandia.cognition.learning.algorithm.baseline.IdentityLearner Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
/*
 * 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();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy