All Downloads are FREE. Search and download functionalities are using the official Maven repository.

weka.experiment.ResultMatrix Maven / Gradle / Ivy

Go to download

The Waikato Environment for Knowledge Analysis (WEKA), a machine learning workbench. This version represents the developer version, the "bleeding edge" of development, you could say. New functionality gets added to this version.

There is a newer version: 3.9.6
Show newest version
/*
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see .
 */

/*
 * ResultMatrix.java
 * Copyright (C) 2005-2012 University of Waikato, Hamilton, New Zealand
 *
 */

package weka.experiment;

import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;

import weka.core.Option;
import weka.core.OptionHandler;
import weka.core.RevisionHandler;
import weka.core.Utils;

/**
 * This matrix is a container for the datasets and classifier setups and their
 * statistics. Derived classes output the data in different formats. Derived
 * classes need to implement the following methods:
 * 
    *
  • toStringMatrix()
  • *
  • toStringKey()
  • *
  • toStringHeader()
  • *
  • toStringSummary()
  • *
  • toStringRanking()
  • *
* * * @author FracPete (fracpete at waikato dot ac dot nz) * @version $Revision: 10204 $ * @see #toStringMatrix() * @see #toStringKey() * @see #toStringHeader() * @see #toStringSummary() * @see #toStringRanking() */ public abstract class ResultMatrix implements Serializable, RevisionHandler, OptionHandler { /** for serialization. */ private static final long serialVersionUID = 4487179306428209739L; /** tie. */ public final static int SIGNIFICANCE_TIE = 0; /** win. */ public final static int SIGNIFICANCE_WIN = 1; /** loss. */ public final static int SIGNIFICANCE_LOSS = 2; /** tie string. */ public String TIE_STRING = " "; /** win string. */ public String WIN_STRING = "v"; /** loss string. */ public String LOSS_STRING = "*"; /** the left parentheses for enumerating cols/rows. */ public String LEFT_PARENTHESES = "("; /** the right parentheses for enumerating cols/rows. */ public String RIGHT_PARENTHESES = ")"; /** the column names. */ protected String[] m_ColNames = null; /** the row names. */ protected String[] m_RowNames = null; /** whether a column is hidden. */ protected boolean[] m_ColHidden = null; /** whether a row is hidden. */ protected boolean[] m_RowHidden = null; /** the significance. */ protected int[][] m_Significance = null; /** the values. */ protected double[][] m_Mean = null; /** the standard deviation. */ protected double[][] m_StdDev = null; /** the counts for the different datasets. */ protected double[] m_Counts = null; /** the standard mean precision. */ protected int m_MeanPrec; /** the standard std. deviation preicision. */ protected int m_StdDevPrec; /** whether std. deviations are printed as well. */ protected boolean m_ShowStdDev; /** whether the average for each column should be printed. */ protected boolean m_ShowAverage; /** whether the names or numbers are output as column declarations. */ protected boolean m_PrintColNames; /** whether the names or numbers are output as row declarations. */ protected boolean m_PrintRowNames; /** * whether a "(x)" is printed before each column name with "x" as the index. */ protected boolean m_EnumerateColNames; /** whether a "(x)" is printed before each row name with "x" as the index. */ protected boolean m_EnumerateRowNames; /** the size of the names of the columns. */ protected int m_ColNameWidth; /** the size of the names of the rows. */ protected int m_RowNameWidth; /** the size of the mean columns. */ protected int m_MeanWidth; /** the size of the std dev columns. */ protected int m_StdDevWidth; /** the size of the significance columns. */ protected int m_SignificanceWidth; /** the size of the counts. */ protected int m_CountWidth; /** contains the keys for the header. */ protected Vector m_HeaderKeys = null; /** contains the values for the header. */ protected Vector m_HeaderValues = null; /** the non-significant wins. */ protected int[][] m_NonSigWins = null; /** the significant wins. */ protected int[][] m_Wins = null; /** the wins in ranking. */ protected int[] m_RankingWins = null; /** the losses in ranking. */ protected int[] m_RankingLosses = null; /** the difference between wins and losses. */ protected int[] m_RankingDiff = null; /** the ordering of the rows. */ protected int[] m_RowOrder = null; /** the ordering of the columns. */ protected int[] m_ColOrder = null; /** whether to remove the filter name from the dataaset name. */ protected boolean m_RemoveFilterName = false; /** * initializes the matrix as 1x1 matrix. */ public ResultMatrix() { this(1, 1); } /** * initializes the matrix with the given dimensions. * * @param cols the number of columns * @param rows the number of rows */ public ResultMatrix(int cols, int rows) { setSize(cols, rows); clear(); } /** * initializes the matrix with the values from the given matrix. * * @param matrix the matrix to get the values from */ public ResultMatrix(ResultMatrix matrix) { assign(matrix); } /** * Returns a string describing the matrix. * * @return a description suitable for displaying in the experimenter gui */ public abstract String globalInfo(); /** * Returns an enumeration of all the available options.. * * @return an enumeration of all available options. */ @Override public Enumeration




© 2015 - 2024 Weber Informatics LLC | Privacy Policy