// Path: CTBNCToolkit/clustering/ClusteringResults.java
// public class ClusteringResults<TimeType extends Number> extends GenericLearningResults {
// 	
// 	private List<IClassificationResult<TimeType>> clusterizedTrajectories;
// 	
// 	/**
// 	 * Constructor.
// 	 * 
// 	 * @param sStats calculated sufficient statistics
// 	 * @param clusterizedTrajectories clusterized trajectories
// 	 */
// 	ClusteringResults(SufficientStatistics[] sStats, List<IClassificationResult<TimeType>> clusterizedTrajectories) {
// 		
// 		super(sStats);
// 		this.clusterizedTrajectories = clusterizedTrajectories;
// 	}
// 	
// 	
// 	/**
// 	 * Return the clusterized trajectories.
// 	 * 
// 	 * @return clusterized trajectories
// 	 */
// 	public List<IClassificationResult<TimeType>> getClusterizedTrajectories() {
// 		
// 		return this.clusterizedTrajectories;
// 	}
// 	
// }


import CTBNCToolkit.performances.*;
import java.util.*;
import CTBNCToolkit.*;
import CTBNCToolkit.clustering.ClusteringResults;
		}

		
		// Cross Validation
		for ( int f = 0; f < foldedDataset.size(); ++f)
		{
			// Performances generation
			SingPType performances = this.aggregatePerformancesFactory.newSingleRunInstance(classIndexToValue);
			
			// Training set and test set generation
			List<ITrajectory<TimeType>> testSet  = this.foldedDataset.get( f);
			List<ITrajectory<TimeType>> trainSet = this.joinOtherFolds(this.foldedDataset, f);
			

			// Model learning
			super.verbosePrint( "\nCycle " + (f+1) + "\n");
			super.verbosePrint( "Learning: from " + trainSet.get(0).getName() + " To " + trainSet.get(trainSet.size()-1).getName() + "\n");
			super.verbosePrint( "          from " + testSet.get(0).getName() + " To " +  testSet.get(testSet.size()-1 ).getName() + " excluded\n");

			long startTime = System.currentTimeMillis();
			ILearningResults classificationResult = learnAlgo.learn( mdl, trainSet);
			double learningTime = (System.currentTimeMillis() - startTime) / 1000.0;
			// In sample performances
			if( super.getClusterInSampleFlag() && ClusteringResults.class.isAssignableFrom(classificationResult.getClass())) {
			
				if( aggInSamplePerformances == null)	// generate in sample aggregate container
					aggInSamplePerformances = this.aggregatePerformancesFactory.newAggregateInstance(classIndexToValue);
				
				// Create the in sample test performances
				SingPType inSampleSinglePerformance = this.aggregatePerformancesFactory.newSingleRunInstance(classIndexToValue);
// Path: CTBNCToolkit/clustering/ClusteringResults.java
// public class ClusteringResults<TimeType extends Number> extends GenericLearningResults {
// 	
// 	private List<IClassificationResult<TimeType>> clusterizedTrajectories;
// 	
// 	/**
// 	 * Constructor.
// 	 * 
// 	 * @param sStats calculated sufficient statistics
// 	 * @param clusterizedTrajectories clusterized trajectories
// 	 */
// 	ClusteringResults(SufficientStatistics[] sStats, List<IClassificationResult<TimeType>> clusterizedTrajectories) {
// 		
// 		super(sStats);
// 		this.clusterizedTrajectories = clusterizedTrajectories;
// 	}
// 	
// 	
// 	/**
// 	 * Return the clusterized trajectories.
// 	 * 
// 	 * @return clusterized trajectories
// 	 */
// 	public List<IClassificationResult<TimeType>> getClusterizedTrajectories() {
// 		
// 		return this.clusterizedTrajectories;
// 	}
// 	
// }


// Path: CTBNCToolkit/tests/validators/CrossValidation.java
import CTBNCToolkit.performances.*;
import java.util.*;
import CTBNCToolkit.*;
import CTBNCToolkit.clustering.ClusteringResults;

		}

		
		// Cross Validation
		for ( int f = 0; f < foldedDataset.size(); ++f)
		{
			// Performances generation
			SingPType performances = this.aggregatePerformancesFactory.newSingleRunInstance(classIndexToValue);
			
			// Training set and test set generation
			List<ITrajectory<TimeType>> testSet  = this.foldedDataset.get( f);
			List<ITrajectory<TimeType>> trainSet = this.joinOtherFolds(this.foldedDataset, f);
			

			// Model learning
			super.verbosePrint( "\nCycle " + (f+1) + "\n");
			super.verbosePrint( "Learning: from " + trainSet.get(0).getName() + " To " + trainSet.get(trainSet.size()-1).getName() + "\n");
			super.verbosePrint( "          from " + testSet.get(0).getName() + " To " +  testSet.get(testSet.size()-1 ).getName() + " excluded\n");

			long startTime = System.currentTimeMillis();
			ILearningResults classificationResult = learnAlgo.learn( mdl, trainSet);
			double learningTime = (System.currentTimeMillis() - startTime) / 1000.0;
			// In sample performances
			if( super.getClusterInSampleFlag() && ClusteringResults.class.isAssignableFrom(classificationResult.getClass())) {
			
				if( aggInSamplePerformances == null)	// generate in sample aggregate container
					aggInSamplePerformances = this.aggregatePerformancesFactory.newAggregateInstance(classIndexToValue);
				
				// Create the in sample test performances
				SingPType inSampleSinglePerformance = this.aggregatePerformancesFactory.newSingleRunInstance(classIndexToValue);
				inSampleSinglePerformance.addResults((( ClusteringResults<TimeType>)classificationResult).getClusterizedTrajectories() );