<commit_before>package callbacks;

import javadestin.*;


public class BeliefGraphCallback extends DestinIterationFinishedCallback {
	private FPSCallback fps = new FPSCallback(0);
	
@Override
	public void callback(INetwork network) {
                
		int states = network.getBeliefsPerNode(7);
		float [] beliefs = Util.toJavaArray(network.getNodeBeliefs(7, 0, 0), states);
		
		int beliefWidth = 20;
		System.out.print("\033[2J");//clearscreen
		System.out.flush();
		
                System.out.println("states:"+states);
		fps.callback(network);
		
		for(int s = 0 ; s < states; s++){
			int b = (int)(beliefs[s] * beliefWidth);
                        System.out.print(s+":"+beliefs[s]+":");
			for(int i = 0 ; i < b ; i++){
				System.out.print(s);
			}
			System.out.println();
		}
		System.out.println("-------------------");
		<commit_msg>tweaked belief display<commit_after>package callbacks;

import java.text.DecimalFormat;
import javadestin.*;


public class BeliefGraphCallback extends DestinIterationFinishedCallback {
	private FPSCallback fps = new FPSCallback(0);
        private DecimalFormat df = new DecimalFormat("0.0000");
	
@Override
	public void callback(INetwork network) {
        int layer = 7;
		int states = network.getBeliefsPerNode(layer);
		float [] beliefs = Util.toJavaArray(network.getNodeBeliefs(layer, 0, 0), states);
		
		int beliefWidth = 80; // how many character columns in chart line, doesn't
                                      // have to match the size of the belief vector
		System.out.print("\033[2J");//clearscreen
		System.out.flush();
		
                System.out.println("states:"+states);
		fps.callback(network);
		
		for(int s = 0 ; s < states; s++){
			int b = (int)(beliefs[s] * beliefWidth);
                        System.out.print(s+":"+df.format(beliefs[s])+":");
			for(int i = 0 ; i < b ; i++){
				System.out.print("X");
			}
			System.out.println();
		}
		System.out.println("-------------------");
		
{'fraction_non_alphanumeric': 0.1600609756097561, 'fraction_numerical': 0.01524390243902439, 'mean_word_length': 2.7504761904761903, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6819430', 'n_tokens_mistral': 691, 'n_tokens_neox': 609, 'n_words': 139}