<commit_before>package org.encog.neural.networks.training;

import org.encog.cloud.CloudTask;
import org.encog.cloud.EncogCloud;
import org.encog.util.Format;

public class TrainingStatusUtility {
	
	private long lastUpdate;
	private int iteration;
	private Train train;
	private EncogCloud cloud;
	private CloudTask task;
	
	public TrainingStatusUtility(EncogCloud cloud, Train train)
	{
		this.cloud = cloud;
		this.train = train;
		this.lastUpdate = 0;
		this.iteration = 0;
	}
	
	public void update()
	{
		long now = System.currentTimeMillis();
		long elapsed = (now-lastUpdate)/1000;
		
		if( task==null )
		{
			this.task = this.cloud.beginTask(train.getClass().getSimpleName());
		}
		
		this.iteration++;
		
		if( elapsed>10 )
		{
			this.lastUpdate = now;
			StringBuilder status = new StringBuilder();
			status.append("Iteration #");
			status.append(Format.formatInteger(this.iteration));
			status.append(" - Error: ");
			status.append(Format.formatPercent(train.getError()));
			this.task.setStatus(status.toString());
		}
	}
	
	public void finish()
	{
		StringBuilder status = new StringBuilder();
		status.append("Done at iteration #");
		status.append(Format.formatInteger(this.iteration));
		status.append(" - Error: ");
		status.append(Format.formatPercent(train.getError()));
		
		this.task.stop(status.toString());
		this.task = null;
	}
}
<commit_msg>Added javadoc to traning status utility.<commit_after>package org.encog.neural.networks.training;

import org.encog.cloud.CloudTask;
import org.encog.cloud.EncogCloud;
import org.encog.util.Format;

/**
 * Report the status of Encog training to the cloud.
 */
public class TrainingStatusUtility {

	/**
	 * The last time an update was performed.
	 */
	private long lastUpdate;
	
	/**
	 * The iteration number.
	 */
	private int iteration;
	
	/**
	 * The training object.
	 */
	private Train train;
	
	/**
	 * The cloud.
	 */
	private EncogCloud cloud;
	
	/**
	 * The task that we are reporting to.
	 */
	private CloudTask task;
	
	/**
	 * Create a training status utility.
	 * @param cloud The cloud to report to.
	 * @param train The training object being used.
	 */
	public TrainingStatusUtility(EncogCloud cloud, Train train)
	{
		this.cloud = cloud;
		this.train = train;
		this.lastUpdate = 0;
		this.iteration = 0;
	}
	
	/**
	 * Perform an update.
	 */
	public void update()
	{
		long now = System.currentTimeMillis();
		long elapsed = (now-lastUpdate)/1000;
		
		if( task==null )
		{
			this.task = this.cloud.beginTask(train.getClass().getSimpleName());
		}
		
		this.iteration++;
		
		if( elapsed>10 )
		{
			this.lastUpdate = now;
			StringBuilder status = new StringBuilder();
			status.append("Iteration #");
			status.append(Format.formatInteger(this.iteration));
			status.append(" - Error: ");
			status.append(Format.formatPercent(train.getError()));
			this.task.setStatus(status.toString());
		}
	}
	
	/**
	 * Report that we are finished.
	 */
	public void finish()
	{
		StringBuilder status = new StringBuilder();
		status.append("Done at iteration #");
		status.append(Format.formatInteger(this.iteration));
		status.append(" - Error: ");
		status.append(Format.formatPercent(train.getError()));
		
		this.task.stop(status.toString());
		this.task = null;
	}
}

{'fraction_non_alphanumeric': 0.13043478260869565, 'fraction_numerical': 0.004700352526439483, 'mean_word_length': 2.9639115250291037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1693786', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1037, 'n_words': 231}