Commit bd1cc665 authored by lafabregue's avatar lafabregue

finalisation of merge with master

parent 119b5fee
This diff is collapsed.
......@@ -20,6 +20,7 @@ import jcl.learning.methods.monostrategy.som.ParametersSOM;
import jcl.weights.ClassificationWeights;
import jcl.weights.GlobalWeights;
import jcl.weights.Weights;
import mustic.gui.DataDesktopFrame;
import mustic.gui.DesktopFrame;
import mustic.gui.ImageDesktopFrame;
import mustic.gui.MainFrame;
......@@ -861,52 +862,52 @@ public class ClassifierHandler extends DefaultHandler {
} else if (qName.equals("InitMethod")) { //$NON-NLS-1$
Data data = null;
DesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllDesktopFrames();
DataDesktopFrame[] desktopFrames = MainFrame.getInstance().getDesktop()
.getAllDataDesktopFrames();
int nbSessions = desktopFrames.length;
for (int i = 0; i < nbSessions; i++) {
if (this.listData.get(0).equals(
desktopFrames[i].getImageSession().getRawImage()
.getPath())) {
data = desktopFrames[i].getImageSession().getImageData();
desktopFrames[i].getDataSession().getAssociatedImageSessions().get(0)
.getRawImage().getPath())) {
data = desktopFrames[i].getDataSession().getData();
break;
}
}
if (data == null) {
File f = new File(this.listData.get(0));
try {
MainFrame.getInstance().createSession(
MainFrame.getInstance().createImageSession(
MainFrame.getInstance().open(f), null);
if (MainFrame.getInstance().getCurrentSession()
if (MainFrame.getInstance().getCurrentImageSession()
.getRawImage().getNbBands() > 1) {
MainFrame.getInstance().getCurrentSession()
MainFrame.getInstance().getCurrentImageSession()
.getBirdViewPanel().setR(0);
MainFrame.getInstance().getCurrentSession()
MainFrame.getInstance().getCurrentImageSession()
.getBirdViewPanel().setG(1);
MainFrame.getInstance().getCurrentSession()
MainFrame.getInstance().getCurrentImageSession()
.getBirdViewPanel().setB(2);
MainFrame
.getInstance()
.getCurrentSession()
.getCurrentImageSession()
.getBirdViewPanel()
.syncImage(
MainFrame.getInstance()
.getCurrentSession());
.getCurrentImageSession());
PictureTool.setR(MainFrame.getInstance()
.getCurrentSession().getRawImage()
.getCurrentImageSession().getRawImage()
.getBirdview(), 0);
PictureTool.setG(MainFrame.getInstance()
.getCurrentSession().getRawImage()
.getCurrentImageSession().getRawImage()
.getBirdview(), 1);
PictureTool.setB(MainFrame.getInstance()
.getCurrentSession().getRawImage()
.getCurrentImageSession().getRawImage()
.getBirdview(), 2);
MainFrame.getInstance().getCurrentSession()
MainFrame.getInstance().getCurrentImageSession()
.getBirdViewPanel().refresh();
MainFrame.getInstance().getCurrentSession().associatedFrame
MainFrame.getInstance().getCurrentImageSession().associatedFrame
.toBack();
data = MainFrame.getInstance().getCurrentSession()
data = MainFrame.getInstance().getCurrentImageSession()
.getData();
}
} catch (Exception e) {
......
......@@ -18,17 +18,9 @@ import jcl.Classification;
import jcl.data.Data;
import jcl.data.DataObject;
import jcl.data.attribute.AttributeMultiDimSequence;
import jcl.data.attribute.AttributeSequence;
import jcl.data.distance.Distance;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.data.distance.EmptyDistanceParameter;
import jcl.data.distance.average.AverageParameter;
import jcl.data.distance.average.EmptyAverageParameter;
import jcl.data.distance.average.ParameterDBAMean;
import jcl.data.distance.sequential.DistanceDTW;
import jcl.data.distance.sequential.DistanceDTWMD;
import jcl.data.distance.sequential.ParameterDTW;
import jcl.io.arff.ClassificationParametersIO;
import jcl.jcld.RmiServer;
import jcl.learning.LearningParameters;
......@@ -955,25 +947,9 @@ public class ClassifierPanel extends JPanel {
}
/* generates distance parameters */
// DistanceParameter[][] distanceParameters = new DistanceParameter[1][model.getDistances().length];
// int i = 0;
// for (Distance d : model.getDistances()) {
// if(d instanceof DistanceDTWMD) {
// AttributeMultiDimSequence seq = (AttributeMultiDimSequence) data.getOneDataObject().getAttribute(i);//need the corresponding attribute to get the sequence length
// distanceParameters[0][i] = new ParameterDTW(new double[seq.getNbTuples()][seq.getNbTuples()]); //special attribute for DTW distances (requires a matrix to work in)
// }
// else if(d instanceof DistanceDTW) {
// AttributeSequence seq = (AttributeSequence) data.getOneDataObject().getAttribute(i);//need the corresponding attribute to get the sequence length
// distanceParameters[0][i] = new ParameterDTW(new double[seq.getNbTuples()][seq.getNbTuples()]); //special attribute for DTW distances (requires a matrix to work in)
// }
// else {
// distanceParameters[0][i] = EmptyDistanceParameter.getInstance();//no parameter for a numerical euclidean distance
// }
// i++;
// }
int nbThreads = Runtime.getRuntime().availableProcessors();
DistanceParameter[][] distanceParameters = DistanceModel.generateDefaultDistanceParameters(nbThreads, model, data);
AverageParameter[] averageParameters = DistanceModel.generateDefaultAverageParameters(model, data);
int choice = this.modele.getSelectedApproach();
......@@ -996,7 +972,8 @@ public class ClassifierPanel extends JPanel {
System.out.println(nbClassifications + " " + nbClustersMin + " " //$NON-NLS-1$ //$NON-NLS-2$
+ nbClustersMax);
params = new ParametersEvidence(nbClassifications, nbClustersMax, nbClustersMin, pourcentage, model, distanceParameters);
params = new ParametersEvidence(nbClassifications, nbClustersMax, nbClustersMin, pourcentage,
model, distanceParameters, averageParameters);
return params;
}
......@@ -1022,7 +999,6 @@ public class ClassifierPanel extends JPanel {
if (filePath.endsWith(".arff")) { //$NON-NLS-1$
int[][] clustering = DataArffExchange.arffToClusteredIndexes(filePath);
List<DataObject> result = ClassifierKmeans.getCentroidsFromClustering(data, clustering, model, null );//TODO
AverageParameter[] averageParameters = DistanceModel.generateDefaultAverageParameters(model, data);
params = new ParametersKmeans(result.size(), 0, model, distanceParameters, averageParameters);
params.setSamples(new Vector<DataObject>(result));
} else {
......@@ -1066,7 +1042,6 @@ public class ClassifierPanel extends JPanel {
// }
// distanceParametersK[th] = distanceParameters;
// }
AverageParameter[] averageParameters = DistanceModel.generateDefaultAverageParameters(model, data);
params = new ParametersKmeans(nbClusters, nbIters, nbThreads, model, distanceParameters, averageParameters);
params.setModel(model);
break;
......@@ -1075,7 +1050,6 @@ public class ClassifierPanel extends JPanel {
int nbClusters = Integer.valueOf(((JTextField) comp[1]).getText()).intValue();
int nbIters = Integer.valueOf(((JTextField) comp[3]).getText()).intValue();
double m = Double.valueOf(((JTextField) comp[5]).getText()).doubleValue();
AverageParameter[] averageParameters = DistanceModel.generateDefaultAverageParameters(model, data);
params = new ParametersKmeans(nbClusters, nbIters, m, model, distanceParameters, averageParameters);
break;
}
......@@ -1085,7 +1059,7 @@ public class ClassifierPanel extends JPanel {
int maxDepth = Integer.valueOf(((JTextField) comp[5]).getText()).intValue();
int nombre_passes = Integer.valueOf(((JTextField) comp[7]).getText()).intValue();
int minCard = Integer.valueOf(((JTextField) comp[9]).getText()).intValue();
params = new ParametersCobweb(acuteness, mapi, maxDepth, nombre_passes, minCard, model, distanceParameters);
params = new ParametersCobweb(acuteness, mapi, maxDepth, nombre_passes, minCard);
break;
}
case ClassifierUtils.SOM: {
......@@ -1093,7 +1067,7 @@ public class ClassifierPanel extends JPanel {
int heigth = Integer.valueOf(((JTextField) comp[3]).getText()).intValue();
int nbIters = Integer.valueOf(((JTextField) comp[5]).getText()).intValue();
double epsilon = Double.valueOf(((JTextField) comp[7]).getText()).doubleValue();
params = new ParametersSOM(width, heigth, nbIters, epsilon, weights);
params = new ParametersSOM(width, heigth, nbIters, epsilon, model, distanceParameters);
break;
}
case ClassifierUtils.PERCEPTRON: {
......@@ -1105,19 +1079,18 @@ public class ClassifierPanel extends JPanel {
case ClassifierUtils.EM: {
int nbClusters = Integer.valueOf(((JTextField) comp[1]).getText()).intValue();
int nbIters = Integer.valueOf(((JTextField) comp[3]).getText()).intValue();
params = new ParametersEM(nbClusters, nbIters, model, distanceParameters);
params = new ParametersEM(nbClusters, nbIters, model, distanceParameters, averageParameters);
break;
}
case ClassifierUtils.RANDOM: {
int nbClusters = Integer.valueOf(((JTextField) comp[1]).getText()).intValue();
params = new ParametersRandom(nbClusters, weights);
params = new ParametersRandom(nbClusters);
break;
}
case ClassifierUtils.GWKMEANS: {
int nbClusters = Integer.valueOf(((JTextField) comp[1]).getText()).intValue();
int nbIters = Integer.valueOf(((JTextField) comp[3]).getText()).intValue();
double beta = Double.valueOf(((JTextField) comp[5]).getText()).doubleValue();
AverageParameter[] averageParameters = DistanceModel.generateDefaultAverageParameters(model, data);
params = new ParametersKmeans(nbClusters, nbIters, beta, ParametersKmeans.GLOBAL_FEATURE_WEIGHTING,
model, distanceParameters, averageParameters);
break;
......@@ -1127,7 +1100,6 @@ public class ClassifierPanel extends JPanel {
int nbIters = Integer.valueOf(((JTextField) comp[3]).getText()).intValue();
double m = Double.valueOf(((JTextField) comp[5]).getText()).doubleValue();
double beta = Double.valueOf(((JTextField) comp[7]).getText()).doubleValue();
AverageParameter[] averageParameters = DistanceModel.generateDefaultAverageParameters(model, data);
params = new ParametersKmeans(nbClusters, nbIters, m, beta, ParametersKmeans.GLOBAL_FEATURE_WEIGHTING,
model, distanceParameters, averageParameters);
break;
......@@ -1136,7 +1108,6 @@ public class ClassifierPanel extends JPanel {
int nbClusters = Integer.valueOf(((JTextField) comp[1]).getText()).intValue();
int nbIters = Integer.valueOf(((JTextField) comp[3]).getText()).intValue();
double beta = Double.valueOf(((JTextField) comp[5]).getText()).doubleValue();
AverageParameter[] averageParameters = DistanceModel.generateDefaultAverageParameters(model, data);
params = new ParametersKmeans(nbClusters, nbIters, beta, ParametersKmeans.LOCAL_FEATURE_WEIGHTING,
model, distanceParameters, averageParameters);
break;
......@@ -1146,7 +1117,6 @@ public class ClassifierPanel extends JPanel {
int nbIters = Integer.valueOf(((JTextField) comp[3]).getText()).intValue();
double m = Double.valueOf(((JTextField) comp[5]).getText()).doubleValue();
double beta = Double.valueOf(((JTextField) comp[7]).getText()).doubleValue();
AverageParameter[] averageParameters = DistanceModel.generateDefaultAverageParameters(model, data);
params = new ParametersKmeans(nbClusters, nbIters, m, beta, ParametersKmeans.LOCAL_FEATURE_WEIGHTING,
model, distanceParameters, averageParameters);
break;
......
......@@ -115,15 +115,12 @@ public class MaclawClassificationParametersPanel extends JPanel {
break;
}
ClassificationWeights weights = new GlobalWeights(new Weights(
this.data.getOneDataObject().getNbAttributes()));
this.param = new ParametersMaclaw(distributed, nbGenerations,
nbIndividuals, nbClusters, nbRefs,
ClassifierModular.PRODUCT, nbCpu, initParams, initParams,
fuzzy, alpha, phi, clusterQualityCriterion,
ClassifierMaclaw.WEIGHTING, ClassifierMaclaw.GENETIC, 1.,
weights);
ClassifierMaclaw.WEIGHTING, ClassifierMaclaw.GENETIC, 1.,
initParams.getModel(), initParams.getDistanceParameters());
}
return this.param;
}
......
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