<commit_before>package cs437.som.demo;

import cs437.som.TrainableSelfOrganizingMap;
import cs437.som.gui.SOMBuilder;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * An image edge detector using a self-organizing map.
 */
public class EdgeDetector {
    /** The minimum distance between 2 colors to classify as a change in detail */
    private static final int MINIMUM_COLOR_DISTANCE = 60;

    /** Better than stdout... */
    private static final Logger log = Logger.getLogger("EdgeDetector");
    private static final int BYTEMASK = 0xFF;
    private static final int TWO_BYTE_SHIFT = 16;
    private static final int ONE_BYTE_SHIFT = 8;
    private static final int FRAME_LOCATION_OFFSET = 400;

    /** The ED's SOM */
    private TrainableSelfOrganizingMap som = null;

    /** The number of possible 3x3 matrices with each element having 3 possible
     * values.  This is the expected number of iterations for a SOM that will
     * be exhaustively trained.
     */
    public static final int threeRaiseNine = 19683;

    /** The number of possible colors that can be stored in 24 bits (2^25 - 1) */
    private static final int possibleColors = 33554431;

    /**
     * Create an empty EdgeDetector.
     */
    private EdgeDetector() {
    }

    /**
     * Create an edge detector.
     *
     * @param iterations The number of iterations used in training the SOM.
     */
    private EdgeDetector(int iterations) {
        SOMBuilder somb = new SOMBuilder(9, iterations);<commit_msg>Minor spelling...<commit_after>package cs437.som.demo;

import cs437.som.TrainableSelfOrganizingMap;
import cs437.som.gui.SOMBuilder;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * An image edge detector using a self-organizing map.
 */
public class EdgeDetector {
    /** The minimum distance between 2 colors to classify as a change in detail */
    private static final int MINIMUM_COLOR_DISTANCE = 60;

    /** Better than standard out... */
    private static final Logger log = Logger.getLogger("EdgeDetector");
    private static final int BYTEMASK = 0xFF;
    private static final int TWO_BYTE_SHIFT = 16;
    private static final int ONE_BYTE_SHIFT = 8;
    private static final int FRAME_LOCATION_OFFSET = 400;

    /** The ED's SOM */
    private TrainableSelfOrganizingMap som = null;

    /** The number of possible 3x3 matrices with each element having 3 possible
     * values.  This is the expected number of iterations for a SOM that will
     * be exhaustively trained.
     */
    public static final int threeRaiseNine = 19683;

    /** The number of possible colors that can be stored in 24 bits (2^25 - 1) */
    private static final int possibleColors = 33554431;

    /**
     * Create an empty EdgeDetector.
     */
    private EdgeDetector() {
    }

    /**
     * Create an edge detector.
     *
     * @param iterations The number of iterations used in training the SOM.
     */
    private EdgeDetector(int iterations) {
        SOMBuilder somb = new SOMBuilder(9, iterations);
{'fraction_non_alphanumeric': 0.08612040133779264, 'fraction_numerical': 0.023411371237458192, 'mean_word_length': 3.2124413145539905, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1064928', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1011, 'n_words': 367}