gov.sandia.cognition.learning.data.DefaultPartitionedDataset 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: DefaultPartitionedDataset.java
* Authors: Justin Basilico
* Company: Sandia National Laboratories
* Project: Cognitive Foundry
*
* Copyright May 26, 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.data;
import java.util.Collection;
/**
* The PartitionedDataset class provides a simple container for the training
* and testing datasets to be held together.
*
* @param
* The type of the data in the dataset.
* @author Justin Basilico
* @author Kevin R. Dixon
* @since 3.0
*/
public class DefaultPartitionedDataset
extends Object
implements PartitionedDataset
{
/** The training dataset. */
private Collection trainingSet = null;
/** The testing dataset. */
private Collection testingSet = null;
/**
* Creates a new instance of PartitionedDataset.
*
* @param trainingSet The training set.
* @param testingSet The testing set.
*/
public DefaultPartitionedDataset(
final Collection trainingSet,
final Collection testingSet)
{
super();
this.setTrainingSet(trainingSet);
this.setTestingSet(testingSet);
}
public Collection getTrainingSet()
{
return this.trainingSet;
}
public Collection getTestingSet()
{
return this.testingSet;
}
/**
* Sets the training set.
*
* @param trainingSet The new training set.
*/
protected void setTrainingSet(
final Collection trainingSet)
{
this.trainingSet = trainingSet;
}
/**
* Sets the testing set.
*
* @param testingSet The new testing set.
*/
protected void setTestingSet(
final Collection testingSet)
{
this.testingSet = testingSet;
}
/**
* Convenience method to create a new {@code DefaultPartitionedDataset}
* from the two given collections.
*
* @param
* The type of the data in the dataset.
* @param trainingSet
* The training set.
* @param testingSet
* The testing set.
* @return
* A new default partitioned dataset with the given training and
* testing sets.
*/
public static DefaultPartitionedDataset create(
final Collection trainingSet,
final Collection testingSet)
{
return new DefaultPartitionedDataset(trainingSet, testingSet);
}
}