<commit_before>package dh.algorithms.classification;

import java.util.HashMap;

import dh.data.column.AbstractDataColumn;
import dh.data.column.base.BooleanDataColumn;
import dh.data.column.base.DoubleDataColumn;
import dh.data.column.special.NominalDataColumn;
import dh.repository.Table;
import dh.repository.Model;

public abstract class ClassificationModel extends Model {

	private static final long serialVersionUID = 1L;

	public ClassificationModel() {
		super("");
	}

	public ClassificationModel(String name) {
		super(name);
	}

	protected boolean[] getPredictionData(Table table) {
		for (AbstractDataColumn c : table.getColumns().values()) {
			if (c.getRole().equals("prediction")) {
				return ((BooleanDataColumn) c).getData();
			}
		}

		BooleanDataColumn prediction = new BooleanDataColumn();
		prediction.setName("prediction");
		prediction.setRole("prediction");
		boolean[] nullElements = new boolean[table.getSize()];
		boolean[] p = new boolean[table.getSize()];
		for (int i = 0; i < table.getSize(); i++) {
			p[i] = false;
			nullElements[i] = false;
		}
		prediction.setData(p);
		table.getColumns().put(prediction.getName(), prediction);

		return p;
	}

	protected double[] getNumericPredictionData(Table table) {
		for (AbstractDataColumn c : table.getColumns().values()) {
			if (c.getRole().equals("numericprediction")) {
				return ((DoubleDataColumn) c).getData();
			}
		}

		DoubleDataColumn numericPrediction = new DoubleDataColumn();
		numericPrediction.setName("numericprediction");
		numericPrediction.setRole("numericprediction");
		double[] numericP = new double[table.getSize()];
		boolean[] nullElements = new boolean[table.getSize()];
		for (int i = 0; i < table.getSize(); i++) {
			numericP[i] = 0.0;
			nullElements[i] = false;
		}
		numericPrediction.setData(numericP);
		numericPrediction.setNullElements(nullElements);

		table.getColumns().put(numericPrediction.getName(), numericPrediction);

		return numericP;
	}

	protected int[] getNominalPredictionData(Table table, String[] labels) {
		for (AbstractDataColumn c : table.getColumns().values()) {
			if (c.getRole().equals("nominalprediction")) {
				return ((NominalDataColumn) c).getData();
			}
		}

		NominalDataColumn nominalPrediction = new NominalDataColumn();
		nominalPrediction.setName("nominalprediction");
		nominalPrediction.setRole("nominalprediction");
<commit_msg>Removes unnecessary null boolean arrays from ClassificationModel<commit_after>package dh.algorithms.classification;

import java.util.HashMap;

import dh.data.column.AbstractDataColumn;
import dh.data.column.base.BooleanDataColumn;
import dh.data.column.base.DoubleDataColumn;
import dh.data.column.special.NominalDataColumn;
import dh.repository.Table;
import dh.repository.Model;

public abstract class ClassificationModel extends Model {

	private static final long serialVersionUID = 1L;

	public ClassificationModel() {
		super("");
	}

	public ClassificationModel(String name) {
		super(name);
	}

	protected boolean[] getPredictionData(Table table) {
		for (AbstractDataColumn c : table.getColumns().values()) {
			if (c.getRole().equals("prediction")) {
				return ((BooleanDataColumn) c).getData();
			}
		}

		BooleanDataColumn prediction = new BooleanDataColumn();
		prediction.setName("prediction");
		prediction.setRole("prediction");
		boolean[] p = new boolean[table.getSize()];
		for (int i = 0; i < table.getSize(); i++) {
			p[i] = false;
		}
		prediction.setData(p);
		table.getColumns().put(prediction.getName(), prediction);

		return p;
	}

	protected double[] getNumericPredictionData(Table table) {
		for (AbstractDataColumn c : table.getColumns().values()) {
			if (c.getRole().equals("numericprediction")) {
				return ((DoubleDataColumn) c).getData();
			}
		}

		DoubleDataColumn numericPrediction = new DoubleDataColumn();
		numericPrediction.setName("numericprediction");
		numericPrediction.setRole("numericprediction");
		double[] numericP = new double[table.getSize()];
		for (int i = 0; i < table.getSize(); i++) {
			numericP[i] = 0.0;
		}
		numericPrediction.setData(numericP);

		table.getColumns().put(numericPrediction.getName(), numericPrediction);

		return numericP;
	}

	protected int[] getNominalPredictionData(Table table, String[] labels) {
		for (AbstractDataColumn c : table.getColumns().values()) {
			if (c.getRole().equals("nominalprediction")) {
				return ((NominalDataColumn) c).getData();
			}
		}

		NominalDataColumn nominalPrediction = new NominalDataColumn();
		nominalPrediction.setName("nominalprediction");
		nominalPrediction.setRole("nominalprediction");

{'fraction_non_alphanumeric': 0.1362847222222222, 'fraction_numerical': 0.002170138888888889, 'mean_word_length': 5.287858117326057, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5009275', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1379, 'n_words': 279}