Skip to content
Snippets Groups Projects
Commit 720bd77c authored by a.croix's avatar a.croix
Browse files

Add method to store RocCoordinates in CSV file

parent a46cbaab
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,12 @@
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.3.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.3.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.3.1" level="project" />
<orderEntry type="library" name="Maven: com.opencsv:opencsv:4.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.1" level="project" />
<orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.9.3" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.2" level="project" />
<orderEntry type="library" name="Maven: com.owlike:genson:1.4" level="project" />
<orderEntry type="library" name="Maven: info.debatty:java-aggregation:0.4" level="project" />
<orderEntry type="module-library">
......
......@@ -47,6 +47,13 @@
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>4.1</version>
</dependency>
<!-- Only for testing the last version of java-wowa-training -->
<dependency>
<groupId>com.owlike</groupId>
......@@ -68,7 +75,7 @@
<systemPath>${project.basedir}/../java-wowa-training/target/java-wowa-training-0.0.4-SNAPSHOT.jar</systemPath>
</dependency>
</dependencies>
<!-- ________________________________________________________________________________________________________________________>
<!-- ________________________________________________________________________________________________________________________-->
<build>
<plugins>
<!-- leave this one first, to be sure we use this recent version -->
......
package be.cylab.java.roc;
import com.opencsv.CSVWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class Utils {
......@@ -23,4 +29,23 @@ public class Utils {
}
return negative_examples;
}
public static void storeRocCoordinatesInCSVFile(List<RocCoordinates> elements, String filepath) {
File file = new File(filepath);
try {
FileWriter outputfile = new FileWriter(file);
CSVWriter writer = new CSVWriter(outputfile);
List<String[]> data = new ArrayList<>();
for (RocCoordinates element : elements) {
String[] el = new String[] { Double.toString(element.getFalseAlarm()),Double.toString(element.getTrueDetection())};
data.add(el);
}
writer.writeAll(data);
writer.close();
}
catch (IOException e) {
e.printStackTrace();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment