Commit 8cfbc6cf authored by balanche's avatar balanche

Début progress bar classify (Progressable implémenté dans Classification et learningResult)

parent 9cb71b1c
......@@ -19,6 +19,7 @@ import jcl.jcld.RmiServer;
import jcl.jcld.database.SSHParameters;
import jcl.learning.LearningMethod;
import jcl.learning.methods.ClassifierUtils;
import jcl.utils.Progressable;
import jcl.utils.exceptions.JCLFormatException;
import jcl.utils.exceptions.MethodNotImplementedException;
......@@ -35,7 +36,7 @@ import jcl.utils.exceptions.MethodNotImplementedException;
*/
public abstract class Classification extends Observable implements
Serializable, Cloneable {
Progressable, Serializable, Cloneable {
/** */
private static final long serialVersionUID = 1L;
......@@ -49,7 +50,7 @@ public abstract class Classification extends Observable implements
/** paramtre de la connection ssh si besoin */
public SSHParameters sshParameters = null;
/** panel ou il faut afficher la non disponibiliter du server rmi */
/** panel ou il faut afficher la non disponibilite du server rmi */
transient public JPanel container_;
/** titre de la classid pour le tabedpane en hybridclassification */
......@@ -68,7 +69,21 @@ public abstract class Classification extends Observable implements
/** Le nom de la classification */
private String name = "";
/**
* Parametre de progression pour l'affichage eventuel d'une barre de
* progression
*/
protected int progress = 0;
/** Valeur maximale de la progression */
protected int progressM = 100;
/** Name of the current step of learning */
private String statusName = "Classifying";
/**
* <p>
* Methode utilisee pour le debuggage. Affiche le contenu de la memoire.
......@@ -767,5 +782,72 @@ public abstract class Classification extends Observable implements
* @return the Classification generated
*/
public abstract Classification ImportResult(String model, int classifIndex) throws MethodNotImplementedException, JCLFormatException;
/**
* <p>
* Fin de la progression.
* </p>
*/
@Override
public void endProgress() {
this.progress = this.progressM;
}
/**
* <p>
* Accesseur au niveau de progression des calculs.
* </p>
*
* @return le compteur de progression
*/
@Override
public int getProgress() {
return (int) (((double) this.progress / (double) this.progressM) * 100.0);
}
/**
* <p>
* Incrementation du niveau de progression.
* </p>
*/
@Override
public void incProgress() {
this.progress++;
}
/**
* <p>
* Remise e zero du niveau de progression.
* </p>
*/
@Override
public void resetProgress() {
this.progress = 0;
}
/**
* <p>
* Modification du niveau de progression des calculs.
* </p>
*
* @param value
* la nouvelle valeur du compteur de progression
*/
@Override
public void setProgress(final int value) {
this.progressM = value;
}
@Override
public void setStatus(String status)
{
statusName = status;
}
@Override
public String getStatus()
{
return statusName;
}
}
......@@ -7,6 +7,7 @@ import java.util.List;
import jcl.Classification;
import jcl.clustering.ClusteringResult;
import jcl.data.Data;
import jcl.utils.Progressable;
import jcl.utils.exceptions.JCLFormatException;
import jcl.utils.exceptions.MethodNotImplementedException;
import jcl.weights.ClassificationWeights;
......@@ -21,7 +22,7 @@ import jcl.weights.ClassificationWeights;
* @author WEMMERT Cedric
*/
public abstract class LearningResult extends Object implements Serializable {
public abstract class LearningResult extends Object implements Progressable,Serializable {
/** */
private static final long serialVersionUID = 1L;
......@@ -46,7 +47,20 @@ public abstract class LearningResult extends Object implements Serializable {
/** allow to specify a specific set of colors to all clustering result generated by this model */
protected List<Color> colors = null;
/**
* Parametre de progression pour l'affichage eventuel d'une barre de
* progression
*/
protected int progress = 0;
/** Valeur maximale de la progression */
protected int progressM = 100;
/** Name of the current step of learning */
private String statusName = "Classifying";
/**
* <p>
* Constructeur a partir d'un ensemble de parametres et de ponderations.
......@@ -204,4 +218,72 @@ public abstract class LearningResult extends Object implements Serializable {
* @return the LearningResult generated
*/
protected abstract LearningResult ImportResult(String model) throws MethodNotImplementedException, JCLFormatException;
/**
* <p>
* Fin de la progression.
* </p>
*/
@Override
public void endProgress() {
this.progress = this.progressM;
}
/**
* <p>
* Accesseur au niveau de progression des calculs.
* </p>
*
* @return le compteur de progression
*/
@Override
public int getProgress() {
return (int) (((double) this.progress / (double) this.progressM) * 100.0);
}
/**
* <p>
* Incrementation du niveau de progression.
* </p>
*/
@Override
public void incProgress() {
this.progress++;
}
/**
* <p>
* Remise e zero du niveau de progression.
* </p>
*/
@Override
public void resetProgress() {
this.progress = 0;
}
/**
* <p>
* Modification du niveau de progression des calculs.
* </p>
*
* @param value
* la nouvelle valeur du compteur de progression
*/
@Override
public void setProgress(final int value) {
this.progressM = value;
}
@Override
public void setStatus(String status)
{
statusName = status;
}
@Override
public String getStatus()
{
return statusName;
}
}
......@@ -7,6 +7,7 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.Vector;
import javax.naming.Context;
......@@ -330,16 +331,17 @@ public class SingleClassification extends Classification {
}
} else {
if (this.learningResult == null) {
// System.out.println("debut learn");
System.out.println("debut learn"+new Date().toString());
this.learn();
// System.out.println("fin learn");
System.out.println("fin learn"+new Date().toString());
}
//SEPARATION ICI ?
System.out.println("debut classify"+new Date().toString());
this.clusteringResult = this.learningResult
.classify(this.classificationData, false);
System.out.println("fin classify"+new Date().toString());
this.clusteringResult.setMethode(this.learningMethod.getType());
/*
* si l'utilisateur souhaite une classification hierarchique, il
* faut encore appliquer l'algorithme de classification hierarchique
......
......@@ -145,11 +145,11 @@ public class LearningResultKmeans extends LearningResult {
((LightHardSeed) this.seeds.get(i)).setId(i);
}
}
// long startT = System.nanoTime();
// System.out.println("start at "+startT);
long startT = System.nanoTime();
System.out.println("start at "+startT);
int clusterMap[] = this.clusterAffectation(data,fromSample);
// long endT = System.nanoTime();
// System.out.println("endat "+ endT + " total of "+ (endT - startT)/1000000000l);
long endT = System.nanoTime();
System.out.println("endat "+ endT + " total of "+ (endT - startT)/1000000000l);
ClusteringResult result = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment