Brève interruption de service ce midi pour augmentation de la mémoire 🤞

Commit 81816bb8 authored by lafabregue's avatar lafabregue

Modification of test files

parent bae79103
...@@ -24,14 +24,11 @@ import jcl.clustering.constraints.Constraint; ...@@ -24,14 +24,11 @@ import jcl.clustering.constraints.Constraint;
import jcl.clustering.constraints.MustLinkConstraint; import jcl.clustering.constraints.MustLinkConstraint;
import jcl.data.Data; import jcl.data.Data;
import jcl.data.Model; import jcl.data.Model;
import jcl.data.SimpleData;
import jcl.data.attribute.AttributeMultiDimSequence; import jcl.data.attribute.AttributeMultiDimSequence;
import jcl.data.distance.Distance; import jcl.data.distance.Distance;
import jcl.data.distance.DistanceParameter; import jcl.data.distance.DistanceParameter;
import jcl.data.distance.EmptyDistanceParameter;
import jcl.data.distance.MetaDistance; import jcl.data.distance.MetaDistance;
import jcl.data.distance.MetaDistanceEuclidean; import jcl.data.distance.MetaDistanceEuclidean;
import jcl.data.distance.NumericalEuclideanDistance;
import jcl.data.distance.sequential.ParameterDTW; import jcl.data.distance.sequential.ParameterDTW;
import jcl.data.mask.IntArrayMask; import jcl.data.mask.IntArrayMask;
import jcl.data.mask.Mask; import jcl.data.mask.Mask;
...@@ -52,8 +49,8 @@ public class TestA2CNESIterative { ...@@ -52,8 +49,8 @@ public class TestA2CNESIterative {
final String datasetName = "FacesUCR"; final String datasetName = "FacesUCR";
final String datasetPath = "FacesUCR"; final String datasetPath = "FacesUCR";
final String dataPath = "~/A2CNES/"; final String dataPath = System.getProperty("user.home")+"/A2CNES/";
final String resultPath = "~/A2CNES/results_iter/"; final String resultPath = System.getProperty("user.home")+"/A2CNES/results_iter/";
final int nInf = 12; final int nInf = 12;
final int nSup = 17; final int nSup = 17;
final int ag1_seeds = 16; final int ag1_seeds = 16;
...@@ -61,7 +58,7 @@ public class TestA2CNESIterative { ...@@ -61,7 +58,7 @@ public class TestA2CNESIterative {
final int ag3_seeds = 24; final int ag3_seeds = 24;
final int nb_iter = 15; final int nb_iter = 15;
// String testResultPath = "~/A2CNES/Train_results/"; // String testResultPath = System.getProperty("user.home")+"/A2CNES/Train_results/";
// Data dataTrain = TestA2CNES.getDataFromFile(dataPath+datasetPath+"/train/"+datasetName+".data", '\t', "train", null); // Data dataTrain = TestA2CNES.getDataFromFile(dataPath+datasetPath+"/train/"+datasetName+".data", '\t', "train", null);
final Data dataTest = TestA2CNES.getDataFromFile(dataPath+datasetPath+"/test/"+datasetName+".data", '\t', "test", null); final Data dataTest = TestA2CNES.getDataFromFile(dataPath+datasetPath+"/test/"+datasetName+".data", '\t', "test", null);
...@@ -164,6 +161,7 @@ public class TestA2CNESIterative { ...@@ -164,6 +161,7 @@ public class TestA2CNESIterative {
try (DirectoryStream<Path> dirStream = Files.newDirectoryStream( try (DirectoryStream<Path> dirStream = Files.newDirectoryStream(
Paths.get(dataPath+datasetName+"/train/"), "*0.1_*")) { Paths.get(dataPath+datasetName+"/train/"), "*0.1_*")) {
Iterator<Path> iter = dirStream.iterator(); Iterator<Path> iter = dirStream.iterator();
final String rand = Integer.toString((int) (Math.random()*1000));
while(iter.hasNext()) { while(iter.hasNext()) {
final Vector<Constraint> constraints = new Vector<Constraint>(); final Vector<Constraint> constraints = new Vector<Constraint>();
String filename = iter.next().getFileName().toString(); String filename = iter.next().getFileName().toString();
...@@ -220,7 +218,6 @@ public class TestA2CNESIterative { ...@@ -220,7 +218,6 @@ public class TestA2CNESIterative {
Thread t = null; Thread t = null;
t = new Thread() { t = new Thread() {
@Override @Override
public void run() { public void run() {
...@@ -234,7 +231,7 @@ public class TestA2CNESIterative { ...@@ -234,7 +231,7 @@ public class TestA2CNESIterative {
FileWriter fw = null; FileWriter fw = null;
try { try {
fw = new FileWriter("log_cst"+classif.getName()+".log", true); fw = new FileWriter("log/"+rand+"log_cst"+classif.getName()+".log", true);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -242,7 +239,7 @@ public class TestA2CNESIterative { ...@@ -242,7 +239,7 @@ public class TestA2CNESIterative {
PrintWriter out = new PrintWriter(bw); PrintWriter out = new PrintWriter(bw);
Distance[] distances = new Distance[1]; // a distance is set for every attribute Distance[] distances = new Distance[1]; // a distance is set for every attribute
distances[0] = jcl.data.distance.sequential.DistanceDTW.getInstance(); // second attribute (sequential) compared with the DTW distance distances[0] = jcl.data.distance.sequential.DistanceDTWMD.getInstance(); // second attribute (sequential) compared with the DTW distance
MetaDistance metaDistance = MetaDistanceEuclidean.getInstance(); // defines the way the two scores are combined (possibility to weight) MetaDistance metaDistance = MetaDistanceEuclidean.getInstance(); // defines the way the two scores are combined (possibility to weight)
Model model = new Model(distances, metaDistance); Model model = new Model(distances, metaDistance);
...@@ -268,9 +265,9 @@ public class TestA2CNESIterative { ...@@ -268,9 +265,9 @@ public class TestA2CNESIterative {
} }
Mask satisfactionMask = new IntArrayMask(satisifiedMap, 1, true); Mask satisfactionMask = new IntArrayMask(satisifiedMap, 1, true);
extractAndAddConstraints(subset, constraints, subsetSize, satisfactionMask); Vector<Constraint> subset = extractConstraints(constraints, subsetSize, satisfactionMask);
out.println("------- new iter : "+ (i+1) + " --------"); out.println("------- new iter : "+ (i+1) + " --------");
for (Constraint c : constraints) { for (Constraint c : subset) {
if (c instanceof MustLinkConstraint) { if (c instanceof MustLinkConstraint) {
MustLinkConstraint ml = (MustLinkConstraint) c; MustLinkConstraint ml = (MustLinkConstraint) c;
out.println(c.toString()+";"+ out.println(c.toString()+";"+
......
This diff is collapsed.
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