clusterEvents = cdTask.getEventsList();
+ this.graphCanvas.setClusterEventsList(clusterEvents);
+ }
+ this.graphCanvas.setGraph(acc1[0], acc2[0], this.graphCanvas.getMeasureSelected(), (int) processFrequency);
+ this.graphCanvas.updateCanvas(true);
+ this.graphCanvas.forceAddEvents();
+ this.clusteringVisualEvalPanel1.update();
+
+ }
+
+ private double parseDouble(String s) {
+ double ret = 0;
+ if (s.equals("?") == false) {
+ ret = Double.parseDouble(s);
+ }
+ return ret;
+ }
+
+ private void scrollPane0MouseWheelMoved(java.awt.event.MouseWheelEvent evt) {//GEN-FIRST:event_scrollPane0MouseWheelMoved
+ streamPanel0.setZoom(evt.getX(), evt.getY(), (-1) * evt.getWheelRotation(), scrollPane0);
+ }//GEN-LAST:event_scrollPane0MouseWheelMoved
+
+ private void buttonZoomInXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonZoomInXActionPerformed
+ graphCanvas.scaleXResolution(false);
+ }//GEN-LAST:event_buttonZoomInXActionPerformed
+
+ private void buttonZoomOutYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonZoomOutYActionPerformed
+ graphCanvas.setSize(new Dimension(graphCanvas.getWidth(), (int) (graphCanvas.getHeight() * 0.8)));
+ graphCanvas.setPreferredSize(new Dimension(graphCanvas.getWidth(), (int) (graphCanvas.getHeight() * 0.8)));
+ this.graphCanvas.updateCanvas(true);
+ }//GEN-LAST:event_buttonZoomOutYActionPerformed
+
+ private void buttonZoomOutXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonZoomOutXActionPerformed
+ graphCanvas.scaleXResolution(true);
+ }//GEN-LAST:event_buttonZoomOutXActionPerformed
+
+ private void buttonZoomInYActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonZoomInYActionPerformed
+ graphCanvas.setSize(new Dimension(graphCanvas.getWidth(), (int) (graphCanvas.getHeight() * 1.2)));
+ graphCanvas.setPreferredSize(new Dimension(graphCanvas.getWidth(), (int) (graphCanvas.getHeight() * 1.2)));
+ this.graphCanvas.updateCanvas(true);
+ }//GEN-LAST:event_buttonZoomInYActionPerformed
+
+ private void buttonRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRunActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_buttonRunActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton buttonRun;
+
+ private javax.swing.JButton buttonScreenshot;
+
+ private javax.swing.JButton buttonStop;
+
+ private javax.swing.JButton buttonZoomInX;
+
+ private javax.swing.JButton buttonZoomInY;
+
+ private javax.swing.JButton buttonZoomOutX;
+
+ private javax.swing.JButton buttonZoomOutY;
+
+ private javax.swing.JCheckBox checkboxDrawClustering;
+
+ private javax.swing.JCheckBox checkboxDrawGT;
+
+ private javax.swing.JCheckBox checkboxDrawMicro;
+
+ private javax.swing.JCheckBox checkboxDrawPoints;
+
+ private moa.gui.clustertab.ClusteringVisualEvalPanel clusteringVisualEvalPanel1;
+
+ private javax.swing.JComboBox comboX;
+
+ private javax.swing.JComboBox comboY;
+
+ private moa.gui.visualization.GraphCanvas graphCanvas;
+
+ private javax.swing.JPanel graphPanel;
+
+ private javax.swing.JPanel graphPanelControlBottom;
+
+ private javax.swing.JPanel graphPanelControlTop;
+
+ private javax.swing.JScrollPane graphScrollPanel;
+
+ private javax.swing.JLabel jLabel1;
+
+ private javax.swing.JLabel labelEvents;
+
+ private javax.swing.JLabel labelNumPause;
+
+ private javax.swing.JLabel labelX;
+
+ private javax.swing.JLabel labelY;
+
+ private javax.swing.JLabel label_processed_points;
+
+ private javax.swing.JLabel label_processed_points_value;
+
+ private javax.swing.JTextField numPauseAfterPoints;
+
+ private javax.swing.JPanel panelControl;
+
+ private javax.swing.JPanel panelEvalOutput;
+
+ private javax.swing.JPanel panelVisualWrapper;
+
+ private javax.swing.JScrollPane scrollPane0;
+
+ private javax.swing.JScrollPane scrollPane1;
+
+ private javax.swing.JSlider speedSlider;
+
+ private javax.swing.JSplitPane splitVisual;
+
+ private moa.gui.visualization.StreamPanel streamPanel0;
+
+ private moa.gui.visualization.StreamPanel streamPanel1;
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ //reacte on graph selection and find out which measure was selected
+ int selected = Integer.parseInt(e.getActionCommand());
+ int counter = selected;
+ int m_select = 0;
+ int m_select_offset = 0;
+ boolean found = false;
+ for (int i = 0; i < acc1.length; i++) {
+ for (int j = 0; j < acc1[i].getNumMeasures(); j++) {
+ if (acc1[i].isEnabled(j)) {
+ counter--;
+ if (counter < 0) {
+ m_select = i;
+ m_select_offset = j;
+ found = true;
+ break;
+ }
+ }
+ }
+ if (found) {
+ break;
+ }
+ }
+ this.graphCanvas.setGraph(acc1[m_select], acc2[m_select], m_select_offset, this.graphCanvas.getProcessFrequency());
+ this.graphCanvas.forceAddEvents();
+ }
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/statisticaltests/CDF_Normal.java b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/CDF_Normal.java
new file mode 100644
index 000000000..eb2a61250
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/CDF_Normal.java
@@ -0,0 +1,215 @@
+package moa.gui.experimentertab.statisticaltests;
+
+/**
+*
+*This class contains routines to calculate the
+*normal cumulative distribution function (CDF) and
+*its inverse.
+*
+*@version .5 --- June 7, 1996
+*@version .6 --- January 10, 2001 (normcdf added)
+*
+*/
+
+public class CDF_Normal extends Object {
+
+/**
+*
+*This method calculates the normal cdf inverse function.
+*
+*Let PHI(x) be the normal cdf. Suppose that Q calculates
+*1.0 - PHI(x), and that QINV calculates QINV(p) for p in (0.0,.5].
+*Then for p .le. .5, x = PHIINV(p) = -QINV(p).
+*For p .gt. .5, x = PHIINV(p) = QINV(1.0 - p).
+*The formula for approximating QINV is taken from Abramowitz and Stegun,
+*Handbook of Mathematical Functions, Dover, 9th printing,
+*formula 26.2.3, page 933. The error in x is claimed to
+*be less than 4.5e-4 in absolute value.
+*
+*@param p p must lie between 0 and 1. xnormi returns
+* the normal cdf inverse evaluated at p.
+*
+*@author Steve Verrill
+*@version .5 --- June 7, 1996
+ * @return
+*
+*/
+
+// FIX: Eventually I should build in a check that p lies in (0,1)
+
+ public static double xnormi(double p) {
+
+ double arg,t,t2,t3,xnum,xden,qinvp,x,pc;
+
+ final double c[] = {2.515517,
+ .802853,
+ .010328};
+
+ final double d[] = {1.432788,
+ .189269,
+ .001308};
+
+ if (p <= .5) {
+
+ arg = -2.0*Math.log(p);
+ t = Math.sqrt(arg);
+ t2 = t*t;
+ t3 = t2*t;
+
+ xnum = c[0] + c[1]*t + c[2]*t2;
+ xden = 1.0 + d[0]*t + d[1]*t2 + d[2]*t3;
+ qinvp = t - xnum/xden;
+ x = -qinvp;
+
+ return x;
+
+ }
+
+ else {
+
+ pc = 1.0 - p;
+ arg = -2.0*Math.log(pc);
+ t = Math.sqrt(arg);
+ t2 = t*t;
+ t3 = t2*t;
+
+ xnum = c[0] + c[1]*t + c[2]*t2;
+ xden = 1.0 + d[0]*t + d[1]*t2 + d[2]*t3;
+ x = t - xnum/xden;
+
+ return x;
+
+ }
+
+ }
+
+
+/**
+*
+*This method calculates the normal cumulative distribution function.
+*
+*It is based upon algorithm 5666 for the error function, from:
+*
+* Hart, J.F. et al, 'Computer Approximations', Wiley 1968
+*
+*
+*The FORTRAN programmer was Alan Miller. The documentation
+*in the FORTRAN code claims that the function is "accurate
+*to 1.e-15."
+*Steve Verrill
+*translated the FORTRAN code (the March 30, 1986 version)
+*into Java. This translation was performed on January 10, 2001.
+*
+*@param z The method returns the value of the normal
+* cumulative distribution function at z.
+*
+*@version .5 --- January 10, 2001
+ * @return
+*
+*/
+
+
+/*
+
+Here is a copy of the documentation in the FORTRAN code:
+
+ SUBROUTINE NORMP(Z, P, Q, PDF)
+C
+C Normal distribution probabilities accurate to 1.e-15.
+C Z = no. of standard deviations from the mean.
+C P, Q = probabilities to the left & right of Z. P + Q = 1.
+C PDF = the probability density.
+C
+C Based upon algorithm 5666 for the error function, from:
+C Hart, J.F. et al, 'Computer Approximations', Wiley 1968
+C
+C Programmer: Alan Miller
+C
+C Latest revision - 30 March 1986
+C
+
+*/
+
+ public static double normp(double z) {
+
+ double zabs;
+ double p;
+ double expntl,pdf;
+
+ final double p0 = 220.2068679123761;
+ final double p1 = 221.2135961699311;
+ final double p2 = 112.0792914978709;
+ final double p3 = 33.91286607838300;
+ final double p4 = 6.373962203531650;
+ final double p5 = .7003830644436881;
+ final double p6 = .3526249659989109E-01;
+
+ final double q0 = 440.4137358247522;
+ final double q1 = 793.8265125199484;
+ final double q2 = 637.3336333788311;
+ final double q3 = 296.5642487796737;
+ final double q4 = 86.78073220294608;
+ final double q5 = 16.06417757920695;
+ final double q6 = 1.755667163182642;
+ final double q7 = .8838834764831844E-1;
+
+ final double cutoff = 7.071;
+ final double root2pi = 2.506628274631001;
+
+ zabs = Math.abs(z);
+
+// |z| > 37
+
+ if (z > 37.0) {
+
+ p = 1.0;
+
+ return p;
+
+ }
+
+ if (z < -37.0) {
+
+ p = 0.0;
+
+ return p;
+
+ }
+
+// |z| <= 37.
+
+ expntl = Math.exp(-.5*zabs*zabs);
+
+ pdf = expntl/root2pi;
+
+// |z| < cutoff = 10/sqrt(2).
+
+ if (zabs < cutoff) {
+
+ p = expntl*((((((p6*zabs + p5)*zabs + p4)*zabs + p3)*zabs +
+ p2)*zabs + p1)*zabs + p0)/(((((((q7*zabs + q6)*zabs +
+ q5)*zabs + q4)*zabs + q3)*zabs + q2)*zabs + q1)*zabs +
+ q0);
+
+ } else {
+
+ p = pdf/(zabs + 1.0/(zabs + 2.0/(zabs + 3.0/(zabs + 4.0/
+ (zabs + 0.65)))));
+
+ }
+
+ if (z < 0.0) {
+
+ return p;
+
+ } else {
+
+ p = 1.0 - p;
+
+ return p;
+
+ }
+
+ }
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/statisticaltests/Fichero.java b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/Fichero.java
new file mode 100644
index 000000000..c832186c7
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/Fichero.java
@@ -0,0 +1,92 @@
+package moa.gui.experimentertab.statisticaltests;
+
+
+/*
+ * Created on 16-Jun-2004
+ *
+ * Clase implementada funciones para el manejo de ficheros de datos
+ *
+ */
+/**
+ * @author Jes�s Alcal� Fern�ndez
+ *
+ *
+ */
+import java.io.*;
+
+/**
+ *
+ * @author Jes�s Alcal� Fern�ndez
+ */
+public class Fichero {
+
+ /**
+ *
+ * @param nombreFichero
+ * @return
+ */
+ public static String leeFichero(String nombreFichero) {
+ String cadena = "";
+
+ try {
+ FileInputStream fis = new FileInputStream(nombreFichero);
+
+ byte[] leido = new byte[4096];
+ int bytesLeidos = 0;
+
+ while (bytesLeidos != -1) {
+ bytesLeidos = fis.read(leido);
+
+ if (bytesLeidos != -1) {
+ cadena += new String(leido, 0, bytesLeidos);
+ }
+ }
+
+ fis.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+
+ return cadena;
+ }
+
+ /**
+ *
+ * @param nombreFichero
+ * @param cadena
+ */
+ public static void escribeFichero(String nombreFichero, String cadena) {
+ try {
+ FileOutputStream f = new FileOutputStream(nombreFichero);
+ DataOutputStream fis = new DataOutputStream((OutputStream) f);
+
+ fis.writeBytes(cadena);
+
+ fis.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ }
+
+ /**
+ *
+ * @param nombreFichero
+ * @param cadena
+ */
+ public static void AnadirtoFichero(String nombreFichero, String cadena) {
+ try {
+ RandomAccessFile fis = new RandomAccessFile(nombreFichero, "rw");
+ fis.seek(fis.length());
+
+ fis.writeBytes(cadena);
+
+ fis.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ }
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/statisticaltests/PValuePerTwoAlgorithm.java b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/PValuePerTwoAlgorithm.java
new file mode 100644
index 000000000..4ed28cb98
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/PValuePerTwoAlgorithm.java
@@ -0,0 +1,73 @@
+/*
+ * PValuePerTwoAlgorithm.java
+ * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
+ * @author Alberto Verdecia Cabrera (averdeciac@gmail.com)
+ *
+ * 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 .
+ *
+ */
+package moa.gui.experimentertab.statisticaltests;
+
+import java.util.ArrayList;
+
+/**
+ *
+ * @author Alberto Verdecia Cabrera (averdeciac@gmail.com)
+ */
+public class PValuePerTwoAlgorithm {
+
+ public String algName1;
+
+ public String algName2;
+
+ public double PValue;
+
+ /**
+ * Costructor.
+ * @param algName1
+ * @param algName2
+ * @param PValue
+ */
+ public PValuePerTwoAlgorithm(String algName1, String algName2, double PValue) {
+ this.algName1 = algName1;
+ this.algName2 = algName2;
+ this.PValue = PValue;
+ }
+
+ /**
+ *
+ * @param PValue
+ * @return
+ */
+ public boolean isSignicativeBetterThan(double PValue){
+ return this.PValue >= PValue;
+ }
+
+ /**
+ *
+ * @param pvalues
+ * @param name1
+ * @param name2
+ * @return
+ */
+ public static int getIndex(ArrayList pvalues, String name1, String name2){
+ for(int i = 0; i < pvalues.size(); i++){
+ if(pvalues.get(i).algName1.equals(name1)==true && pvalues.get(i).algName2.equals(name2)==true
+ || pvalues.get(i).algName1.equals(name2)==true && pvalues.get(i).algName2.equals(name1)==true)
+ return i;
+
+ }
+ return -1;
+ }
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/statisticaltests/Pareja.java b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/Pareja.java
new file mode 100644
index 000000000..fea80a37f
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/Pareja.java
@@ -0,0 +1,41 @@
+package moa.gui.experimentertab.statisticaltests;
+
+/**
+ *
+ * T�tulo:
+ *
+ * Descripci�n:
+ *
+ * Copyright: Copyright (c) 2005
+ *
+ * Empresa:
+ *
+ * @author sin atribuir
+ * @version 1.0
+ */
+public class Pareja implements Comparable {
+
+ public double indice;
+ public double valor;
+
+ public Pareja() {
+
+ }
+
+ public Pareja(double i, double v) {
+ indice = i;
+ valor = v;
+ }
+
+ public int compareTo(Object o1) { //ordena por valor absoluto
+
+ if (Math.abs(this.valor) > Math.abs(((Pareja) o1).valor)) {
+ return -1;
+ } else if (Math.abs(this.valor) < Math.abs(((Pareja) o1).valor)) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/statisticaltests/RankPerAlgorithm.java b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/RankPerAlgorithm.java
new file mode 100644
index 000000000..6300d63e5
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/RankPerAlgorithm.java
@@ -0,0 +1,54 @@
+/*
+ * RankPerAlgorithm.java
+ * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
+ * @author Alberto Verdecia Cabrera (averdeciac@gmail.com)
+ *
+ * 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 .
+ *
+ */
+package moa.gui.experimentertab.statisticaltests;
+
+/**
+ * This class contains each algorithm with its ranking.
+ *
+ * @author Alberto Verdecia Cabrera (averdeciac@gmail.com)
+ */
+public class RankPerAlgorithm implements Comparable {
+
+ public String algName;
+ public double rank;
+
+ /**
+ * Constructor.
+ *
+ * @param algName
+ * @param rank
+ */
+ public RankPerAlgorithm(String algName, double rank) {
+ this.algName = algName;
+ this.rank = rank;
+ }
+
+ @Override
+ public int compareTo(RankPerAlgorithm r) {
+ if (rank < r.rank) {
+ return -1;
+ }
+ if (rank > r.rank) {
+ return 1;
+ }
+ return 0;
+ }
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/statisticaltests/Relation.java b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/Relation.java
new file mode 100644
index 000000000..6867af01e
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/Relation.java
@@ -0,0 +1,35 @@
+package moa.gui.experimentertab.statisticaltests;
+
+/**
+ *
+ * T�tulo:
+ *
+ * Descripci�n:
+ *
+ * Copyright: Copyright (c) 2005
+ *
+ * Empresa:
+ *
+ * @author sin atribuir
+ * @version 1.0
+ */
+public class Relation {
+
+ public int i;
+ public int j;
+
+ public Relation() {
+
+ }
+
+ public Relation(int x, int y) {
+ i = x;
+ j = y;
+ }
+
+ @Override
+ public String toString() {
+ return "(" + i + "," + j + ")";
+ }
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/statisticaltests/StatisticalTest.java b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/StatisticalTest.java
new file mode 100644
index 000000000..f36c01b1b
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/statisticaltests/StatisticalTest.java
@@ -0,0 +1,673 @@
+/*
+ * StatisticalTest.java
+ * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
+ * @author Alberto Verdecia Cabrera (averdeciac@gmail.com)
+ *
+ * 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 .
+ * The statistical tests programmed in this class were taken from
+ * KEEL(Knowledge Extraction based on Evolutionary Learning) software.
+ * KEEL is an open source (GPLv3) Java software tool that can be used for
+ * a large number of different knowledge data discovery tasks.
+ * J. Alcalá-Fdez, L. Sánchez, S. García, M.J. del Jesus, S. Ventura,
+ * J.M. Garrell, J. Otero, C. Romero, J. Bacardit, V.M. Rivas, J.C. Fernández,
+ * F. Herrera. KEEL: A Software Tool to Assess Evolutionary Algorithms to
+ * Data Mining Problems. Soft Computing 13:3 (2009) 307-318,
+ * doi: 10.1007/s00500-008-0323-y.
+ * J. Alcalá-Fdez, A. Fernandez, J. Luengo, J. Derrac, S. García, L. Sánchez,
+ * F. Herrera. KEEL Data-Mining Software Tool: Data Set Repository,
+ * Integration of Algorithms and Experimental Analysis Framework. Journal of
+ * Multiple-Valued Logic and Soft Computing 17:2-3 (2011) 255-287.
+ */
+package moa.gui.experimentertab.statisticaltests;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.StringTokenizer;
+import moa.gui.experimentertab.Algorithm;
+import moa.gui.experimentertab.Stream;
+
+/**
+ *
+ * @author Alberto Verdecia Cabrera (averdeciac@gmail.com)
+ */
+public class StatisticalTest {
+
+ ArrayList algoritmos;
+ ArrayList datasets;
+ ArrayList datos;
+ //String linea, token;
+ int i, j, k, m;
+ int posicion;
+ double mean[][];
+ Pareja orden[][];
+ Pareja rank[][];
+ boolean encontrado;
+ int ig;
+ double sum;
+ boolean visto[];
+ ArrayList porVisitar;
+ double Rj[];
+ double friedman;
+ double sumatoria = 0;
+ double termino1, termino2, termino3;
+ double iman;
+ boolean vistos[];
+ int pos, tmp;
+ double min;
+ double maxVal;
+ double rankingRef;
+ double Pi[];
+ double ALPHAiHolm[];
+ double ALPHAiShaffer[];
+ String ordenAlgoritmos[];
+ double ordenRankings[];
+ int order[];
+ double adjustedP[][];
+ double Ci[];
+ double SE;
+ boolean parar, otro;
+ ArrayList indices = new ArrayList();
+ ArrayList exhaustiveI = new ArrayList();
+ boolean[][] cuadro;
+ double minPi, tmpPi, maxAPi, tmpAPi;
+ Relation[] parejitas;
+ int lineaN = 0;
+ int columnaN = 0;
+ ArrayList T;
+ int Tarray[];
+ ArrayList rankAlg;
+ double pFriedman, pIman;
+ public List streams = new ArrayList<>();
+
+ /**
+ * Constructor.
+ *
+ * @param streams
+ */
+ public StatisticalTest(List streams) {
+ this.streams = streams;
+ algoritmos = new ArrayList();
+ datasets = new ArrayList();
+ datos = new ArrayList();
+ rankAlg = new ArrayList<>();
+
+ }
+
+ /**
+ * Read a csv file from an path.
+ *
+ * @param path
+ */
+ public void readCSV(String path) {
+ String cadena, linea, token;
+ StringTokenizer lineas, tokens;
+ cadena = Fichero.leeFichero(path);
+ lineas = new StringTokenizer(cadena, "\n\r");
+ while (lineas.hasMoreTokens()) {
+ linea = lineas.nextToken();
+ tokens = new StringTokenizer(linea, ",\t");
+ columnaN = 0;
+ while (tokens.hasMoreTokens()) {
+ if (lineaN == 0) {
+ if (columnaN == 0) {
+ token = tokens.nextToken();
+ } else {
+ token = tokens.nextToken();
+ algoritmos.add(token);
+ datos.add(new ArrayList());
+ }
+ } else {
+ if (columnaN == 0) {
+ token = tokens.nextToken();
+ datasets.add(token);
+ } else {
+ token = tokens.nextToken();
+ ((ArrayList) datos.get(columnaN - 1)).add(new Double(token));
+ }
+ }
+ columnaN++;
+ }
+ lineaN++;
+ }
+ }
+
+ /**
+ * Read data from experiments sumaries.
+ */
+ public void readData() {
+
+ int cont = 0;
+ int algorithmSize = this.streams.get(0).algorithm.size();
+ int streamSize = this.streams.size();
+ int measureSize = this.streams.get(0).algorithm.get(0).measures.size();
+
+ for (int i = 0; i < algorithmSize; i++) {
+ algoritmos.add(this.streams.get(0).algorithm.get(i).name);
+ datos.add(new ArrayList());
+ }
+ for (int i = 0; i < streamSize; i++) {
+ List alg = this.streams.get(i).algorithm;
+ datasets.add(this.streams.get(i).name);
+ for (int j = 0; j < algorithmSize; j++) {
+ ((ArrayList) datos.get(j)).add(alg.get(j).measures.get(cont).getValue());
+ }
+
+ }
+
+ }
+
+ /**
+ * Compute the average ranking of the algorithms.
+ */
+ public void avgPerformance() {
+ mean = new double[datasets.size()][algoritmos.size()];
+
+ /*Compute the average performance per algorithm for each data set*/
+ for (i = 0; i < datasets.size(); i++) {
+ for (j = 0; j < algoritmos.size(); j++) {
+ mean[i][j] = ((Double) ((ArrayList) datos.get(j)).get(i));
+ }
+ }
+
+ /*We use the pareja structure to compute and order rankings*/
+ orden = new Pareja[datasets.size()][algoritmos.size()];
+ for (i = 0; i < datasets.size(); i++) {
+ for (j = 0; j < algoritmos.size(); j++) {
+ orden[i][j] = new Pareja(j, mean[i][j]);
+ }
+ Arrays.sort(orden[i]);
+ }
+
+ /*building of the rankings table per algorithms and data sets*/
+ rank = new Pareja[datasets.size()][algoritmos.size()];
+ posicion = 0;
+ for (i = 0; i < datasets.size(); i++) {
+ for (j = 0; j < algoritmos.size(); j++) {
+ encontrado = false;
+ for (k = 0; k < algoritmos.size() && !encontrado; k++) {
+ if (orden[i][k].indice == j) {
+ encontrado = true;
+ posicion = k + 1;
+ }
+ }
+ rank[i][j] = new Pareja(posicion, orden[i][posicion - 1].valor);
+ }
+ }
+
+ /*In the case of having the same performance, the rankings are equal*/
+ for (i = 0; i < datasets.size(); i++) {
+ visto = new boolean[algoritmos.size()];
+ porVisitar = new ArrayList();
+
+ Arrays.fill(visto, false);
+ for (j = 0; j < algoritmos.size(); j++) {
+ porVisitar.clear();
+ sum = rank[i][j].indice;
+ visto[j] = true;
+ ig = 1;
+ for (k = j + 1; k < algoritmos.size(); k++) {
+ if (rank[i][j].valor == rank[i][k].valor && !visto[k]) {
+ sum += rank[i][k].indice;
+ ig++;
+ porVisitar.add(new Integer(k));
+ visto[k] = true;
+ }
+ }
+ sum /= (double) ig;
+ rank[i][j].indice = sum;
+ for (k = 0; k < porVisitar.size(); k++) {
+ rank[i][((Integer) porVisitar.get(k))].indice = sum;
+ }
+ }
+ }
+ avgRankingPerAlgorithm();
+ }
+
+ private void avgRankingPerAlgorithm() {
+
+ Rj = new double[algoritmos.size()];
+ for (i = 0; i < algoritmos.size(); i++) {
+ Rj[i] = 0;
+ for (j = 0; j < datasets.size(); j++) {
+ Rj[i] += rank[j][i].indice / ((double) datasets.size());
+ }
+ }
+ /*Print the average ranking per algorithm*/
+ for (i = 0; i < algoritmos.size(); i++) {
+ rankAlg.add(new RankPerAlgorithm((String) algoritmos.get(i), Rj[i]));
+ }
+ //Order de Algorithms with rank
+ Collections.sort(rankAlg, new ComparatorImpl());
+
+ /*Compute the Friedman statistic*/
+ termino1 = (12 * (double) datasets.size()) / ((double) algoritmos.size()
+ * ((double) algoritmos.size() + 1));
+ termino2 = (double) algoritmos.size() * ((double) algoritmos.size() + 1)
+ * ((double) algoritmos.size() + 1) / (4.0);
+ for (i = 0; i < algoritmos.size(); i++) {
+ sumatoria += Rj[i] * Rj[i];
+ }
+ friedman = (sumatoria - termino2) * termino1;
+
+ pFriedman = ChiSq(friedman, (algoritmos.size() - 1));
+
+ /*Compute the Iman-Davenport statistic*/
+ iman = ((datasets.size() - 1) * friedman) / (datasets.size() * (algoritmos.size() - 1) - friedman);
+ pIman = FishF(iman, (algoritmos.size() - 1), (algoritmos.size() - 1) * (datasets.size() - 1));
+ //System.out.print("P-value computed by Iman and Daveport Test: " + pIman + ".\\newline\n\n");
+
+ termino3 = Math.sqrt((double) algoritmos.size() * ((double) algoritmos.size() + 1)
+ / (6.0 * (double) datasets.size()));
+ //Inicialize values
+ inicialize();
+
+ }
+
+ /**
+ * Return the p-value computed by Friedman test.
+ *
+ * @return pFriedman
+ */
+ public double getFriedmanPValue() {
+ return pFriedman;
+ }
+
+ /**
+ * Return the p-value Iman and Daveport test.
+ *
+ * @return pIman
+ */
+ public double getImanPValue() {
+ return pIman;
+ }
+
+ /**
+ * Return the ranking of the algorithms.
+ *
+ * @return rankAlg
+ */
+ public ArrayList getRankAlg() {
+ return rankAlg;
+ }
+
+ private void inicialize() {
+ /*Compute the unadjusted p_i value for each comparison alpha=0.10*/
+ Pi = new double[(int) combinatoria(2, algoritmos.size())];
+ ordenAlgoritmos = new String[(int) combinatoria(2, algoritmos.size())];
+ ordenRankings = new double[(int) combinatoria(2, algoritmos.size())];
+ order = new int[(int) combinatoria(2, algoritmos.size())];
+ parejitas = new Relation[(int) combinatoria(2, algoritmos.size())];
+ T = new ArrayList();
+ T = trueHShaffer(algoritmos.size());
+ Tarray = new int[T.size()];
+ for (i = 0; i < T.size(); i++) {
+ Tarray[i] = ((Integer) T.get(i));
+ }
+ Arrays.sort(Tarray);
+ SE = termino3;
+ vistos = new boolean[(int) combinatoria(2, algoritmos.size())];
+ for (i = 0, k = 0; i < algoritmos.size(); i++) {
+ for (j = i + 1; j < algoritmos.size(); j++, k++) {
+ ordenRankings[k] = Math.abs(Rj[i] - Rj[j]);
+ ordenAlgoritmos[k] = (String) algoritmos.get(i) + " vs. " + (String) algoritmos.get(j);
+ parejitas[k] = new Relation(i, j);
+ }
+ }
+
+ Arrays.fill(vistos, false);
+ for (i = 0; i < ordenRankings.length; i++) {
+ for (j = 0; vistos[j] == true; j++);
+ pos = j;
+ maxVal = ordenRankings[j];
+ for (j = j + 1; j < ordenRankings.length; j++) {
+ if (vistos[j] == false && ordenRankings[j] > maxVal) {
+ pos = j;
+ maxVal = ordenRankings[j];
+ }
+ }
+ vistos[pos] = true;
+ order[i] = pos;
+ }
+
+ /*Computing the logically related hypotheses tests (Shaffer and Bergmann-Hommel)*/
+ pos = 0;
+ tmp = Tarray.length - 1;
+ for (i = 0; i < order.length; i++) {
+ Pi[i] = 2 * CDF_Normal.normp((-1) * Math.abs((ordenRankings[order[i]]) / SE));
+
+ }
+
+ }
+
+ /**
+ * Return the p-values computed by the Holm test.
+ *
+ * @return algPValues
+ */
+ public ArrayList holmTest() {
+ ArrayList algPValues = new ArrayList<>();
+ double[] holmPValues;
+ holmPValues = new double[Pi.length];
+
+ for (i = 0; i < holmPValues.length; i++) {
+ holmPValues[i] = Pi[i] * (double) (holmPValues.length - i);
+ }
+ for (i = 1; i < holmPValues.length; i++) {
+ if (holmPValues[i] < holmPValues[i - 1]) {
+ holmPValues[i] = holmPValues[i - 1];
+ }
+ }
+ for (i = 0; i < Pi.length; i++) {
+ algPValues.add(new PValuePerTwoAlgorithm(algoritmos.get(parejitas[order[i]].i).toString(),
+ algoritmos.get(parejitas[order[i]].j).toString(), holmPValues[i]));
+ }
+
+ return algPValues;
+ }
+
+ /**
+ * Return the p-values computed by the Shaffer test.
+ *
+ * @return algPValues
+ */
+ public ArrayList shafferTest() {
+ ArrayList algPValues = new ArrayList<>();
+ double[] shafferPValues;
+ shafferPValues = new double[Pi.length];
+ pos = 0;
+ tmp = Tarray.length - 1;
+ for (i = 0; i < shafferPValues.length; i++) {
+ shafferPValues[i] = Pi[i] * ((double) shafferPValues.length - (double) Math.max(pos, i));
+ if (i == pos) {
+ tmp--;
+ pos = (int) combinatoria(2, algoritmos.size()) - Tarray[tmp];
+ }
+ }
+ for (i = 1; i < shafferPValues.length; i++) {
+ if (shafferPValues[i] < shafferPValues[i - 1]) {
+ shafferPValues[i] = shafferPValues[i - 1];
+ }
+ if (shafferPValues[i] < shafferPValues[i - 1]) {
+ shafferPValues[i] = shafferPValues[i - 1];
+ }
+ }
+
+ for (i = 0; i < Pi.length; i++) {
+ algPValues.add(new PValuePerTwoAlgorithm(algoritmos.get(parejitas[order[i]].i).toString(),
+ algoritmos.get(parejitas[order[i]].j).toString(), shafferPValues[i]));
+ }
+
+ return algPValues;
+ }
+
+ /**
+ * Return the p-values computed by the Nemenyi test.
+ *
+ * @return algPValues
+ */
+ public ArrayList nemenyiTest() {
+ ArrayList algPValues = new ArrayList<>();
+ double[] nemenyiPValues;
+ nemenyiPValues = new double[Pi.length];
+ pos = 0;
+ tmp = Tarray.length - 1;
+ for (i = 0; i < nemenyiPValues.length; i++) {
+ nemenyiPValues[i] = Pi[i] * (double) (nemenyiPValues.length);
+ }
+
+ for (i = 0; i < Pi.length; i++) {
+ algPValues.add(new PValuePerTwoAlgorithm(algoritmos.get(parejitas[order[i]].i).toString(),
+ algoritmos.get(parejitas[order[i]].j).toString(), nemenyiPValues[i]));
+ }
+ return algPValues;
+ }
+
+ private static double combinatoria(int m, int n) {
+
+ double result = 1;
+ int i;
+
+ if (n >= m) {
+ for (i = 1; i <= m; i++) {
+ result *= (double) (n - m + i) / (double) i;
+ }
+ } else {
+ result = 0;
+ }
+ return result;
+ }
+
+ private static ArrayList obtainExhaustive(ArrayList indices) {
+
+ ArrayList result = new ArrayList();
+ int i, j, k;
+ String binario;
+ boolean[] number = new boolean[indices.size()];
+ ArrayList ind1, ind2;
+ ArrayList set = new ArrayList();
+ ArrayList res1, res2;
+ ArrayList temp;
+ ArrayList temp2;
+ ArrayList temp3;
+
+ ind1 = new ArrayList();
+ ind2 = new ArrayList();
+ temp = new ArrayList();
+ temp2 = new ArrayList();
+ temp3 = new ArrayList();
+
+ for (i = 0; i < indices.size(); i++) {
+ for (j = i + 1; j < indices.size(); j++) {
+ set.add(new Relation(((Integer) indices.get(i)), ((Integer) indices.get(j))));
+ }
+ }
+ if (set.size() > 0) {
+ result.add(set);
+ }
+
+ for (i = 1; i < (int) (Math.pow(2, indices.size() - 1)); i++) {
+ Arrays.fill(number, false);
+ ind1.clear();
+ ind2.clear();
+ temp.clear();
+ temp2.clear();
+ temp3.clear();
+ binario = Integer.toString(i, 2);
+ for (k = 0; k < number.length - binario.length(); k++) {
+ number[k] = false;
+ }
+ for (j = 0; j < binario.length(); j++, k++) {
+ if (binario.charAt(j) == '1') {
+ number[k] = true;
+ }
+ }
+ for (j = 0; j < number.length; j++) {
+ if (number[j] == true) {
+ ind1.add(((Integer) indices.get(j)));
+ } else {
+ ind2.add(((Integer) indices.get(j)));
+ }
+ }
+ res1 = obtainExhaustive(ind1);
+ res2 = obtainExhaustive(ind2);
+ for (j = 0; j < res1.size(); j++) {
+ result.add(new ArrayList((ArrayList) res1.get(j)));
+ }
+ for (j = 0; j < res2.size(); j++) {
+ result.add(new ArrayList((ArrayList) res2.get(j)));
+ }
+ for (j = 0; j < res1.size(); j++) {
+ temp = (ArrayList) ((ArrayList) res1.get(j)).clone();
+ for (k = 0; k < res2.size(); k++) {
+ temp2 = (ArrayList) temp.clone();
+ temp3 = (ArrayList) ((ArrayList) res2.get(k)).clone();
+ if (((Relation) temp2.get(0)).i < ((Relation) temp3.get(0)).i) {
+ temp2.addAll((ArrayList) temp3);
+ result.add(new ArrayList(temp2));
+ } else {
+ temp3.addAll((ArrayList) temp2);
+ result.add(new ArrayList(temp3));
+
+ }
+ }
+ }
+ }
+ for (i = 0; i < result.size(); i++) {
+ if (((ArrayList) result.get(i)).toString().equalsIgnoreCase("[]")) {
+ result.remove(i);
+ i--;
+ }
+ }
+ for (i = 0; i < result.size(); i++) {
+ for (j = i + 1; j < result.size(); j++) {
+ if (((ArrayList) result.get(i)).toString().equalsIgnoreCase(((ArrayList) result.get(j)).toString())) {
+ result.remove(j);
+ j--;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static ArrayList trueHShaffer(int k) {
+
+ ArrayList number;
+ int j;
+ ArrayList tmp, tmp2;
+ int p;
+
+ number = new ArrayList();
+ tmp = new ArrayList();
+ if (k <= 1) {
+ number.add(0);
+ } else {
+ for (j = 1; j <= k; j++) {
+ tmp = trueHShaffer(k - j);
+ tmp2 = new ArrayList();
+ for (p = 0; p < tmp.size(); p++) {
+ tmp2.add(((Integer) (tmp.get(p))) + (int) combinatoria(2, j));
+ }
+ number = unionVectores(number, tmp2);
+ }
+ }
+
+ return number;
+ }
+
+ private static ArrayList unionVectores(ArrayList a, ArrayList b) {
+
+ int i;
+
+ for (i = 0; i < b.size(); i++) {
+ if (a.contains(new Integer((Integer) (b.get(i)))) == false) {
+ a.add(b.get(i));
+ }
+ }
+
+ return a;
+ }
+
+ private static double ChiSq(double x, int n) {
+ if (n == 1 & x > 1000) {
+ return 0;
+ }
+ if (x > 1000 | n > 1000) {
+ double q = ChiSq((x - n) * (x - n) / (2 * n), 1) / 2;
+ if (x > n) {
+ return q;
+ }
+ {
+ return 1 - q;
+ }
+ }
+ double p = Math.exp(-0.5 * x);
+ if ((n % 2) == 1) {
+ p = p * Math.sqrt(2 * x / Math.PI);
+ }
+ double k = n;
+ while (k >= 2) {
+ p = p * x / k;
+ k = k - 2;
+ }
+ double t = p;
+ double a = n;
+ while (t > 0.0000000001 * p) {
+ a = a + 2;
+ t = t * x / a;
+ p = p + t;
+ }
+ return 1 - p;
+ }
+
+ private static double FishF(double f, int n1, int n2) {
+ double x = n2 / (n1 * f + n2);
+ if ((n1 % 2) == 0) {
+ return StatCom(1 - x, n2, n1 + n2 - 4, n2 - 2) * Math.pow(x, n2 / 2.0);
+ }
+ if ((n2 % 2) == 0) {
+ return 1
+ - StatCom(x, n1, n1 + n2 - 4, n1 - 2)
+ * Math.pow(1 - x, n1 / 2.0);
+ }
+ double th = Math.atan(Math.sqrt(n1 * f / (1.0 * n2)));
+ double a = th / (Math.PI / 2.0);
+ double sth = Math.sin(th);
+ double cth = Math.cos(th);
+ if (n2 > 1) {
+ a = a
+ + sth * cth * StatCom(cth * cth, 2, n2 - 3, -1) / (Math.PI / 2.0);
+ }
+ if (n1 == 1) {
+ return 1 - a;
+ }
+ double c = 4 * StatCom(sth * sth, n2 + 1, n1 + n2 - 4, n2 - 2) * sth
+ * Math.pow(cth, n2) / Math.PI;
+ if (n2 == 1) {
+ return 1 - a + c / 2.0;
+ }
+ int k = 2;
+ while (k <= (n2 - 1) / 2.0) {
+ c = c * k / (k - .5);
+ k = k + 1;
+ }
+ return 1 - a + c;
+ }
+
+ private static double StatCom(double q, int i, int j, int b) {
+ double zz = 1;
+ double z = zz;
+ int k = i;
+ while (k <= j) {
+ zz = zz * q * k / (k - b);
+ z = z + zz;
+ k = k + 2;
+ }
+ return z;
+ }
+
+ private static class ComparatorImpl implements Comparator {
+
+ public ComparatorImpl() {
+ }
+
+ @Override
+ public int compare(RankPerAlgorithm r1, RankPerAlgorithm r2) {
+ return r1.compareTo(r2);
+ }
+ }
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/tasks/ConceptDriftMainTask.java b/moa/src/main/java/moa/gui/experimentertab/tasks/ConceptDriftMainTask.java
new file mode 100644
index 000000000..dd686dd61
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/tasks/ConceptDriftMainTask.java
@@ -0,0 +1,26 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package moa.gui.experimentertab.tasks;
+
+import java.util.ArrayList;
+import moa.streams.clustering.ClusterEvent;
+
+/**
+ *
+ * @author albert
+ */
+public abstract class ConceptDriftMainTask extends myMainTask {
+
+ protected ArrayList events;
+
+ protected void setEventsList(ArrayList events) {
+ this.events = events;
+ }
+
+ public ArrayList getEventsList() {
+ return this.events;
+ }
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluateConceptDrift.java b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluateConceptDrift.java
new file mode 100644
index 000000000..433ae3f72
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluateConceptDrift.java
@@ -0,0 +1,77 @@
+/*
+ * EvaluatePrequential.java
+ * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
+ * @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
+ * @author Albert Bifet (abifet at cs dot waikato dot ac dot nz)
+ *
+ * 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 .
+ *
+ */
+package moa.gui.experimentertab.tasks;
+
+import moa.core.ObjectRepository;
+import moa.evaluation.ClassificationPerformanceEvaluator;
+import moa.evaluation.LearningCurve;
+import moa.options.ClassOption;
+import com.github.javacliparser.IntOption;
+import moa.evaluation.LearningPerformanceEvaluator;
+import moa.tasks.TaskMonitor;
+
+/**
+ * Task for evaluating a classifier on a stream by testing then training with each example in sequence.
+ *
+ * @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
+ * @author Albert Bifet (abifet at cs dot waikato dot ac dot nz)
+ * @version $Revision: 7 $
+ */
+public class EvaluateConceptDrift extends ConceptDriftMainTask{
+
+
+ @Override
+ public String getPurposeString() {
+ return "Evaluates a classifier on a stream by testing then training with each example in sequence.";
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ public ClassOption evaluatorOption = new ClassOption("evaluator", 'e',
+ "Classification performance evaluation method.",
+ LearningPerformanceEvaluator.class,
+ "BasicConceptDriftPerformanceEvaluator");
+
+ public IntOption instanceLimitOption = new IntOption("instanceLimit", 'i',
+ "Maximum number of instances to test/train on (-1 = no limit).",
+ 1000, -1, Integer.MAX_VALUE);
+
+ public IntOption timeLimitOption = new IntOption("timeLimit", 't',
+ "Maximum number of seconds to test/train for (-1 = no limit).", -1,
+ -1, Integer.MAX_VALUE);
+
+ public IntOption sampleFrequencyOption = new IntOption("sampleFrequency",
+ 'f',
+ "How many instances between samples of the learning performance.",
+ 10, 0, Integer.MAX_VALUE);
+
+
+ @Override
+ public Class> getTaskResultType() {
+ return LearningCurve.class;
+ }
+
+
+ @Override
+ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+}
\ No newline at end of file
diff --git a/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluateInterleavedChunks.java b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluateInterleavedChunks.java
new file mode 100644
index 000000000..26ab9af8f
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluateInterleavedChunks.java
@@ -0,0 +1,113 @@
+/*
+ * EvaluateInterleavedChunks.java
+ * Copyright (C) 2010 Poznan University of Technology, Poznan, Poland
+ * @author Dariusz Brzezinski (dariusz.brzezinski@cs.put.poznan.pl)
+ *
+ * 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 .
+ *
+ */
+package moa.gui.experimentertab.tasks;
+
+import moa.core.ObjectRepository;
+import moa.tasks.*;
+
+import moa.evaluation.ClassificationPerformanceEvaluator;
+import moa.evaluation.LearningCurve;
+import moa.options.ClassOption;
+import com.github.javacliparser.IntOption;
+import moa.evaluation.LearningPerformanceEvaluator;
+
+
+public class EvaluateInterleavedChunks extends myMainTask {
+
+ @Override
+ public String getPurposeString() {
+ return "Evaluates a classifier on a stream by testing then training with chunks of data in sequence.";
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Allows to select the classifier performance evaluation method.
+ */
+ public ClassOption evaluatorOption = new ClassOption("evaluator", 'e',
+ "Learning performance evaluation method.",
+ LearningPerformanceEvaluator.class,
+ "BasicClassificationPerformanceEvaluator");
+
+ /**
+ * Allows to define the maximum number of instances to test/train on (-1 = no limit).
+ */
+ public IntOption instanceLimitOption = new IntOption("instanceLimit", 'i',
+ "Maximum number of instances to test/train on (-1 = no limit).",
+ 100000000, -1, Integer.MAX_VALUE);
+
+ /**
+ * Allow to define the training/testing chunk size.
+ */
+ public IntOption chunkSizeOption = new IntOption("chunkSize", 'c',
+ "Number of instances in a data chunk.",
+ 1000, 1, Integer.MAX_VALUE);
+
+ /**
+ * Allows to define the maximum number of seconds to test/train for (-1 = no limit).
+ */
+ public IntOption timeLimitOption = new IntOption("timeLimit", 't',
+ "Maximum number of seconds to test/train for (-1 = no limit).", -1,
+ -1, Integer.MAX_VALUE);
+
+ /**
+ * Defines how often classifier parameters will be calculated.
+ */
+ public IntOption sampleFrequencyOption = new IntOption("sampleFrequency",
+ 'f',
+ "How many instances between samples of the learning performance.",
+ 100000, 0, Integer.MAX_VALUE);
+
+ /**
+ * Allows to define the memory limit for the created model.
+ */
+ public IntOption maxMemoryOption = new IntOption("maxMemory", 'b',
+ "Maximum size of model (in bytes). -1 = no limit.", -1, -1,
+ Integer.MAX_VALUE);
+
+ /**
+ * Allows to define the frequency of memory checks.
+ */
+ public IntOption memCheckFrequencyOption = new IntOption(
+ "memCheckFrequency", 'q',
+ "How many instances between memory bound checks.", 100000, 0,
+ Integer.MAX_VALUE);
+
+ /**
+ * Allows to define the output file name and location.
+ */
+// public FileOption dumpFileOption = new FileOption("dumpFile", 'd',
+// "File to append intermediate csv reslts to.", null, "csv", true);
+
+ /**
+ * Defines the task's result type.
+ */
+ public Class> getTaskResultType() {
+ return LearningCurve.class;
+ }
+
+ @Override
+ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluateInterleavedTestThenTrain.java b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluateInterleavedTestThenTrain.java
new file mode 100644
index 000000000..7abff4e11
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluateInterleavedTestThenTrain.java
@@ -0,0 +1,86 @@
+/*
+ * EvaluateInterleavedTestThenTrain.java
+ * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
+ * @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
+ *
+ * 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 .
+ *
+ */
+package moa.gui.experimentertab.tasks;
+
+import moa.core.ObjectRepository;
+import moa.tasks.*;
+
+import moa.evaluation.LearningCurve;
+import moa.options.ClassOption;
+import com.github.javacliparser.IntOption;
+import moa.evaluation.LearningPerformanceEvaluator;
+
+/**
+ * Task for evaluating a classifier on a stream by testing then training with
+ * each example in sequence.
+ *
+ * @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
+ * @version $Revision: 7 $
+ */
+public class EvaluateInterleavedTestThenTrain extends myMainTask {
+
+ @Override
+ public String getPurposeString() {
+ return "Evaluates a classifier on a stream by testing then training with each example in sequence.";
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ public IntOption randomSeedOption = new IntOption(
+ "instanceRandomSeed", 'r',
+ "Seed for random generation of instances.", 1);
+
+ public ClassOption evaluatorOption = new ClassOption("evaluator", 'e',
+ "Classification performance evaluation method.",
+ LearningPerformanceEvaluator.class,
+ "BasicClassificationPerformanceEvaluator");
+
+ public IntOption instanceLimitOption = new IntOption("instanceLimit", 'i',
+ "Maximum number of instances to test/train on (-1 = no limit).",
+ 100000000, -1, Integer.MAX_VALUE);
+
+ public IntOption timeLimitOption = new IntOption("timeLimit", 't',
+ "Maximum number of seconds to test/train for (-1 = no limit).", -1,
+ -1, Integer.MAX_VALUE);
+
+ public IntOption sampleFrequencyOption = new IntOption("sampleFrequency",
+ 'f',
+ "How many instances between samples of the learning performance.",
+ 100000, 0, Integer.MAX_VALUE);
+
+ public IntOption memCheckFrequencyOption = new IntOption(
+ "memCheckFrequency", 'q',
+ "How many instances between memory bound checks.", 100000, 0,
+ Integer.MAX_VALUE);
+
+// public FileOption dumpFileOption = new FileOption("dumpFile", 'd',
+// "File to append intermediate csv reslts to.", null,"", true);
+
+ @Override
+ public Class> getTaskResultType() {
+ return LearningCurve.class;
+ }
+
+
+ @Override
+ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluatePeriodicHeldOutTest.java b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluatePeriodicHeldOutTest.java
new file mode 100644
index 000000000..e78af5759
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluatePeriodicHeldOutTest.java
@@ -0,0 +1,85 @@
+/*
+ * EvaluatePeriodicHeldOutTest.java
+ * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
+ * @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
+ * @author Ammar Shaker (shaker@mathematik.uni-marburg.de)
+ *
+ * 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 .
+ *
+ */
+package moa.gui.experimentertab.tasks;
+
+import moa.core.ObjectRepository;
+import moa.evaluation.ClassificationPerformanceEvaluator;
+import moa.evaluation.LearningCurve;
+import moa.tasks.*;
+import moa.options.ClassOption;
+import com.github.javacliparser.FlagOption;
+import com.github.javacliparser.IntOption;
+import moa.evaluation.LearningPerformanceEvaluator;
+
+/**
+ * Task for evaluating a classifier on a stream by periodically testing on a
+ * heldout set.
+ *
+ * @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
+ * @version $Revision: 7 $
+ */
+public class EvaluatePeriodicHeldOutTest extends myMainTask {
+
+ @Override
+ public String getPurposeString() {
+ return "Evaluates a classifier on a stream by periodically testing on a heldout set.";
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ public ClassOption evaluatorOption = new ClassOption("evaluator", 'e',
+ "Classification performance evaluation method.",
+ LearningPerformanceEvaluator.class,
+ "BasicClassificationPerformanceEvaluator");
+
+ public IntOption testSizeOption = new IntOption("testSize", 'n',
+ "Number of testing examples.", 1000000, 0, Integer.MAX_VALUE);
+
+ public IntOption trainSizeOption = new IntOption("trainSize", 'i',
+ "Number of training examples, <1 = unlimited.", 0, 0,
+ Integer.MAX_VALUE);
+
+ public IntOption trainTimeOption = new IntOption("trainTime", 't',
+ "Number of training seconds.", 10 * 60 * 60, 0, Integer.MAX_VALUE);
+
+ public IntOption sampleFrequencyOption = new IntOption(
+ "sampleFrequency",
+ 'f',
+ "Number of training examples between samples of learning performance.",
+ 100000, 0, Integer.MAX_VALUE);
+
+// public FileOption dumpFileOption = new FileOption("dumpFile", 'd',
+// "File to append intermediate csv results to.", null, "csv", true);
+
+ public FlagOption cacheTestOption = new FlagOption("cacheTest", 'c',
+ "Cache test instances in memory.");
+
+ @Override
+ public Class> getTaskResultType() {
+ return LearningCurve.class;
+ }
+
+ @Override
+ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluatePrequential.java b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluatePrequential.java
new file mode 100644
index 000000000..4591bd557
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluatePrequential.java
@@ -0,0 +1,73 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package moa.gui.experimentertab.tasks;
+
+
+import com.github.javacliparser.FileOption;
+import moa.core.ObjectRepository;
+import moa.evaluation.ClassificationPerformanceEvaluator;
+import moa.options.ClassOption;
+import com.github.javacliparser.FloatOption;
+import com.github.javacliparser.IntOption;
+import moa.evaluation.LearningPerformanceEvaluator;
+
+
+import moa.tasks.TaskMonitor;
+
+/**
+ *
+ * @author Alberto
+ */
+public class EvaluatePrequential extends myMainTask{
+ @Override
+ public String getPurposeString() {
+ return "Evaluates a classifier on a stream by testing then training with each example in sequence.";
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ public ClassOption evaluatorOption = new ClassOption("evaluator", 'e',
+ "Classification performance evaluation method.",
+ LearningPerformanceEvaluator.class,
+ "WindowClassificationPerformanceEvaluator");
+
+ public IntOption instanceLimitOption = new IntOption("instanceLimit", 'i',
+ "Maximum number of instances to test/train on (-1 = no limit).",
+ 100000000, -1, Integer.MAX_VALUE);
+
+ public IntOption timeLimitOption = new IntOption("timeLimit", 't',
+ "Maximum number of seconds to test/train for (-1 = no limit).", -1,
+ -1, Integer.MAX_VALUE);
+
+ public IntOption sampleFrequencyOption = new IntOption("sampleFrequency",
+ 'f',
+ "How many instances between samples of the learning performance.",
+ 100000, 0, Integer.MAX_VALUE);
+
+ public IntOption memCheckFrequencyOption = new IntOption(
+ "memCheckFrequency", 'q',
+ "How many instances between memory bound checks.", 100000, 0,
+ Integer.MAX_VALUE);
+
+ //New for prequential method DEPRECATED
+ public IntOption widthOption = new IntOption("width",
+ 'w', "Size of Window", 1000);
+
+ public FloatOption alphaOption = new FloatOption("alpha",
+ 'a', "Fading factor or exponential smoothing factor", .01);
+
+ @Override
+ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public Class> getTaskResultType() {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluatePrequentialCV.java b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluatePrequentialCV.java
new file mode 100644
index 000000000..b929c4f7e
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/tasks/EvaluatePrequentialCV.java
@@ -0,0 +1,114 @@
+/*
+ * EvaluatePrequential.java
+ * Copyright (C) 2007 University of Waikato, Hamilton, New Zealand
+ * @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
+ * @author Albert Bifet (abifet at cs dot waikato dot ac dot nz)
+ *
+ * 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 .
+ *
+ */
+package moa.gui.experimentertab.tasks;
+
+import moa.tasks.*;
+import com.github.javacliparser.FileOption;
+import com.github.javacliparser.FloatOption;
+import com.github.javacliparser.IntOption;
+import com.github.javacliparser.MultiChoiceOption;
+import com.yahoo.labs.samoa.instances.Instance;
+import moa.classifiers.Classifier;
+import moa.core.*;
+import moa.evaluation.*;
+import moa.learners.Learner;
+import moa.options.ClassOption;
+import moa.streams.ExampleStream;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Task for prequential cross-validation evaluation of a classifier on a stream by testing then training with each
+ * example in sequence and doing cross-validation at the same time.
+ *
+ * Albert Bifet, Gianmarco De Francisci Morales, Jesse Read, Geoff Holmes, Bernhard Pfahringer: Efficient Online
+ * Evaluation of Big Data Stream Classifiers. KDD 2015: 59-68
+ *
+ * @author Richard Kirkby (rkirkby@cs.waikato.ac.nz)
+ * @author Albert Bifet (abifet at cs dot waikato dot ac dot nz)
+ * @version $Revision: 7 $
+ */
+public class EvaluatePrequentialCV extends myMainTask {
+
+ @Override
+ public String getPurposeString() {
+ return "Evaluates a classifier on a stream by doing prequential evaluation (testing then training with each" +
+ " example in sequence) and doing cross-validation.";
+ }
+
+ private static final long serialVersionUID = 1L;
+
+ public ClassOption evaluatorOption = new ClassOption("evaluator", 'e',
+ "Classification performance evaluation method.",
+ LearningPerformanceEvaluator.class,
+ "WindowClassificationPerformanceEvaluator");
+
+ public IntOption instanceLimitOption = new IntOption("instanceLimit", 'i',
+ "Maximum number of instances to test/train on (-1 = no limit).",
+ 100000000, -1, Integer.MAX_VALUE);
+
+ public IntOption timeLimitOption = new IntOption("timeLimit", 't',
+ "Maximum number of seconds to test/train for (-1 = no limit).", -1,
+ -1, Integer.MAX_VALUE);
+
+ public IntOption sampleFrequencyOption = new IntOption("sampleFrequency",
+ 'f',
+ "How many instances between samples of the learning performance.",
+ 100000, 0, Integer.MAX_VALUE);
+
+ public IntOption memCheckFrequencyOption = new IntOption(
+ "memCheckFrequency", 'q',
+ "How many instances between memory bound checks.", 100000, 0,
+ Integer.MAX_VALUE);
+
+ public IntOption ensembleSizeOption = new IntOption("ensembleSize", 'w',
+ "The number of distributed models.", 10, 1, Integer.MAX_VALUE);
+
+ public MultiChoiceOption validationMethodologyOption = new MultiChoiceOption(
+ "validationMethodology", 'a', "Validation methodology to use.", new String[]{
+ "Cross-Validation", "Bootstrap-Validation", "Split-Validation"},
+ new String[]{"k-fold distributed Cross Validation",
+ "k-fold distributed Bootstrap Validation",
+ "k-fold distributed Split Validation"
+ }, 0);
+
+ public IntOption randomSeedOption = new IntOption("randomSeed", 'r',
+ "Seed for random behaviour of the task.", 1);
+
+
+ @Override
+ public Class> getTaskResultType() {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+
+ @Override
+ protected Object doMainTask(TaskMonitor monitor, ObjectRepository repository) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+}
diff --git a/moa/src/main/java/moa/gui/experimentertab/tasks/myMainTask.java b/moa/src/main/java/moa/gui/experimentertab/tasks/myMainTask.java
new file mode 100644
index 000000000..7a4e8eae9
--- /dev/null
+++ b/moa/src/main/java/moa/gui/experimentertab/tasks/myMainTask.java
@@ -0,0 +1,70 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package moa.gui.experimentertab.tasks;
+
+
+import moa.core.ObjectRepository;
+import moa.tasks.AbstractTask;
+import moa.tasks.TaskMonitor;
+
+/**
+ *
+ * @author Alberto
+ */
+public abstract class myMainTask extends AbstractTask {
+
+ private static final long serialVersionUID = 1L;
+
+ /** The number of instances between monitor updates. */
+ protected static final int INSTANCES_BETWEEN_MONITOR_UPDATES = 10;
+
+ /** File option to save the final result of the task to. */
+// public FileOption outputFileOption = new FileOption("taskResultFile", 'O',
+// "File to save the final result of the task to.", null, "moa", true);
+
+ @Override
+ protected Object doTaskImpl(TaskMonitor monitor, ObjectRepository repository) {
+ Object result = doMainTask(monitor, repository);
+// if (monitor.taskShouldAbort()) {
+// return null;
+// }
+// File outputFile = this.outputFileOption.getFile();
+// if (outputFile != null) {
+// if (result instanceof Serializable) {
+// monitor.setCurrentActivity("Saving result of task "
+// + getTaskName() + " to file " + outputFile + "...",
+// -1.0);
+// try {
+// SerializeUtils.writeToFile(outputFile,
+// (Serializable) result);
+// } catch (IOException ioe) {
+// throw new RuntimeException("Failed writing result of task "
+// + getTaskName() + " to file " + outputFile, ioe);
+// }
+// } else {
+// throw new RuntimeException("Result of task " + getTaskName()
+// + " is not serializable, so cannot be written to file "
+// + outputFile);
+// }
+// }
+ return result;
+ }
+
+ /**
+ * This method performs this task.
+ * AbstractTask implements doTask,
+ * that uses doTaskImpl.
+ * myMainTask implements doTaskImpl using
+ * doMainTask so its extensions only need to implement
+ * doMainTask.
+ *
+ * @param monitor the TaskMonitor to use
+ * @param repository the ObjectRepository to use
+ * @return an object with the result of this task
+ */
+ protected abstract Object doMainTask(TaskMonitor monitor,
+ ObjectRepository repository);
+}