Unverified Commit 9985cf0f authored by BARBIER Marc's avatar BARBIER Marc
Browse files

mlt update

parent 7d0bb263
......@@ -9,4 +9,3 @@ data/
.project
.settings
.classpath
lib/ConceptualClustering-CP2018-choco4.0.3-jar-with-dependencies.jar
......@@ -2,6 +2,94 @@
<project>
<name>Demo</name>
<items>
<be.uantwerpen.mime__webapp.model.ImageFileItem>
<logicalName>kmeans-satelite-norm42</logicalName>
<version>4</version>
<id>kmeans-satelite-norm42-004</id>
<stackOperations class="linked-list">
<string>kmeans clustering for images : [33, 30, 28, 29, 26, 31, 32, 27] - k=20</string>
<string>Converting to arff</string>
<string>make-windows by images</string>
<string>Mine sequential patterns(GreyScale, CM-SPAM, 1%)</string>
</stackOperations>
<filename>kmeans-satelite-norm42_windowed.arff</filename>
<windowCount>243988</windowCount>
<noColumns>4</noColumns>
<noRows>1951904</noRows>
<patterns>
<patterns>
<filename>kmeans-satelite-norm42_windowed.arff_CM-SPAM_GreyScale_6_4_3__1%_patterns.csv</filename>
<filenameOccurrences>kmeans-satelite-norm42_windowed.arff_CM-SPAM_GreyScale_6_4_3__1%_patterns_occurrences.csv</filenameOccurrences>
<type>sequential patterns</type>
<columns>GreyScale</columns>
<algorithm>CM-SPAM</algorithm>
<support>1</support>
<noPatterns>751</noPatterns>
</patterns>
</patterns>
<scores/>
<width>724</width>
<height>337</height>
<canalCount>4</canalCount>
<image__count>8</image__count>
</be.uantwerpen.mime__webapp.model.ImageFileItem>
<be.uantwerpen.mime__webapp.model.ImageFileItem>
<logicalName>kmeans-satelite-norm42</logicalName>
<version>2</version>
<id>kmeans-satelite-norm42-002</id>
<stackOperations class="linked-list">
<string>kmeans clustering for images : [33, 30, 28, 29, 26, 31, 32, 27] - k=20</string>
<string>Converting to arff</string>
<string>make-windows by images</string>
</stackOperations>
<filename>kmeans-satelite-norm42_windowed.arff</filename>
<windowCount>243988</windowCount>
<noColumns>4</noColumns>
<noRows>1951904</noRows>
<patterns/>
<scores/>
<width>724</width>
<height>337</height>
<canalCount>4</canalCount>
<image__count>8</image__count>
</be.uantwerpen.mime__webapp.model.ImageFileItem>
<be.uantwerpen.mime__webapp.model.ImageFileItem>
<logicalName>kmeans-satelite-norm42</logicalName>
<version>1</version>
<id>kmeans-satelite-norm42-001</id>
<stackOperations class="linked-list">
<string>kmeans clustering for images : [33, 30, 28, 29, 26, 31, 32, 27] - k=20</string>
<string>Converting to arff</string>
</stackOperations>
<filename>kmeans-satelite-norm42.arff</filename>
<windowCount>0</windowCount>
<noColumns>4</noColumns>
<noRows>1951904</noRows>
<patterns/>
<scores/>
<width>724</width>
<height>337</height>
<canalCount>4</canalCount>
<image__count>8</image__count>
</be.uantwerpen.mime__webapp.model.ImageFileItem>
<be.uantwerpen.mime__webapp.model.ImageFileItem>
<logicalName>kmeans-satelite-norm42</logicalName>
<version>0</version>
<id>kmeans-satelite-norm42-000</id>
<stackOperations class="linked-list">
<string>kmeans clustering for images : [33, 30, 28, 29, 26, 31, 32, 27] - k=20</string>
</stackOperations>
<filename>kmeans-satelite-norm42.csv</filename>
<windowCount>0</windowCount>
<noColumns>4</noColumns>
<noRows>1951904</noRows>
<patterns/>
<scores/>
<width>724</width>
<height>337</height>
<canalCount>4</canalCount>
<image__count>8</image__count>
</be.uantwerpen.mime__webapp.model.ImageFileItem>
<item>
<logicalName>lunges_and_sidelunges_vs_squat</logicalName>
<version>10</version>
......@@ -152,94 +240,73 @@
<patterns/>
<scores/>
</item>
<be.uantwerpen.mime__webapp.model.ImageFileItem>
<logicalName>kmeans-satelite-norm42</logicalName>
<item>
<logicalName>dsd</logicalName>
<version>0</version>
<id>kmeans-satelite-norm42-000</id>
<id>dsd-000</id>
<stackOperations class="linked-list">
<string>kmeans clustering for images : [33, 30, 28, 29, 26, 31, 32, 27] - k=20</string>
<string>uploaded dsd.csv</string>
</stackOperations>
<filename>kmeans-satelite-norm42.csv</filename>
<filename>dsd.csv</filename>
<windowCount>0</windowCount>
<noColumns>4</noColumns>
<noRows>1951904</noRows>
<noColumns>2</noColumns>
<noRows>651</noRows>
<patterns/>
<scores/>
<width>724</width>
<height>337</height>
<canalCount>4</canalCount>
<image__count>8</image__count>
</be.uantwerpen.mime__webapp.model.ImageFileItem>
<be.uantwerpen.mime__webapp.model.ImageFileItem>
<logicalName>kmeans-satelite-norm42</logicalName>
</item>
<item>
<logicalName>dsd</logicalName>
<version>1</version>
<id>kmeans-satelite-norm42-001</id>
<id>dsd-001</id>
<stackOperations class="linked-list">
<string>kmeans clustering for images : [33, 30, 28, 29, 26, 31, 32, 27] - k=20</string>
<string>Converting to arff</string>
<string>converted csv to arff</string>
</stackOperations>
<filename>kmeans-satelite-norm42.arff</filename>
<windowCount>0</windowCount>
<noColumns>4</noColumns>
<noRows>1951904</noRows>
<filename>dsd.arff</filename>
<windowCount>50</windowCount>
<noColumns>2</noColumns>
<noRows>650</noRows>
<patterns/>
<scores/>
<width>724</width>
<height>337</height>
<canalCount>4</canalCount>
<image__count>8</image__count>
</be.uantwerpen.mime__webapp.model.ImageFileItem>
<be.uantwerpen.mime__webapp.model.ImageFileItem>
<logicalName>kmeans-satelite-norm42</logicalName>
</item>
<item>
<logicalName>dsd</logicalName>
<version>2</version>
<id>kmeans-satelite-norm42-002</id>
<id>dsd-002</id>
<stackOperations class="linked-list">
<string>kmeans clustering for images : [33, 30, 28, 29, 26, 31, 32, 27] - k=20</string>
<string>Converting to arff</string>
<string>make-windows by images</string>
<string>make-windows (window=13, increment=13)</string>
</stackOperations>
<filename>kmeans-satelite-norm42_windowed.arff</filename>
<windowCount>243988</windowCount>
<noColumns>4</noColumns>
<noRows>1951904</noRows>
<filename>dsd-002.arff</filename>
<windowCount>50</windowCount>
<noColumns>3</noColumns>
<noRows>650</noRows>
<patterns/>
<scores/>
<width>724</width>
<height>337</height>
<canalCount>4</canalCount>
<image__count>8</image__count>
</be.uantwerpen.mime__webapp.model.ImageFileItem>
<be.uantwerpen.mime__webapp.model.ImageFileItem>
<logicalName>kmeans-satelite-norm42</logicalName>
</item>
<item>
<logicalName>dsd</logicalName>
<version>4</version>
<id>kmeans-satelite-norm42-004</id>
<id>dsd-004</id>
<stackOperations class="linked-list">
<string>kmeans clustering for images : [33, 30, 28, 29, 26, 31, 32, 27] - k=20</string>
<string>Converting to arff</string>
<string>make-windows by images</string>
<string>Mine sequential patterns(GreyScale, CM-SPAM, 1%)</string>
<string>make-windows (window=13, increment=13)</string>
<string>Mine sequential patterns(Values, PrefixSpan, 10%)</string>
</stackOperations>
<filename>kmeans-satelite-norm42_windowed.arff</filename>
<windowCount>243988</windowCount>
<noColumns>4</noColumns>
<noRows>1951904</noRows>
<filename>dsd-002.arff</filename>
<windowCount>50</windowCount>
<noColumns>3</noColumns>
<noRows>650</noRows>
<patterns>
<patterns>
<filename>kmeans-satelite-norm42_windowed.arff_CM-SPAM_GreyScale_6_4_3__1%_patterns.csv</filename>
<filenameOccurrences>kmeans-satelite-norm42_windowed.arff_CM-SPAM_GreyScale_6_4_3__1%_patterns_occurrences.csv</filenameOccurrences>
<filename>dsd-002.arff_PrefixSpan_Values_10%_patterns.csv</filename>
<filenameOccurrences>dsd-002.arff_PrefixSpan_Values_10%_patterns_occurrences.csv</filenameOccurrences>
<type>sequential patterns</type>
<columns>GreyScale</columns>
<algorithm>CM-SPAM</algorithm>
<support>1</support>
<noPatterns>751</noPatterns>
<columns>Values</columns>
<algorithm>PrefixSpan</algorithm>
<support>10</support>
<noPatterns>1905</noPatterns>
</patterns>
</patterns>
<scores/>
<width>724</width>
<height>337</height>
<canalCount>4</canalCount>
<image__count>8</image__count>
</be.uantwerpen.mime__webapp.model.ImageFileItem>
</item>
</items>
</project>
</list>
\ No newline at end of file
/home/marc/Documents/Polytech/stage/git/mlt-clustering/target/ConceptualClustering-CP2018-choco4.0.3.jar
\ No newline at end of file
......@@ -5,12 +5,15 @@ package be.uantwerpen.mime_webapp.controller;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Optional;
import java.util.TreeMap;
import javax.servlet.http.HttpServletRequest;
......@@ -26,7 +29,7 @@ import be.uantwerpen.ldataminining.utils.CollectionUtils;
import be.uantwerpen.mime_webapp.Settings;
import be.uantwerpen.mime_webapp.model.FileItem;
import be.uantwerpen.mime_webapp.model.PatternSet;
import hybrid.model.HybridClustering;
import hybrid.model.HybridSoftClustering;
import hybrid.model.ResultModel;
@RestController
......@@ -58,10 +61,13 @@ public class MltClusteringController extends AbstractController {
"-c", clustering.getAbsolutePath()
};
ResultModel[] results = HybridClustering.runAsApi(args);
ResultModel[] results = HybridSoftClustering.runAsApi(args);
if(results.length == 0) return ResponseEntity.ok("No solution found");
createNewDatasetFromResultModel(occurrencesTable, results[0]);
//TODO: re encode using those values
return ResponseEntity.ok(null);
......@@ -69,6 +75,21 @@ public class MltClusteringController extends AbstractController {
private void createNewDatasetFromResultModel(Table occurrencesTable, ResultModel resultModel) {
List<Integer> patternIds = Arrays.stream(resultModel.clustering).boxed().toList();
//tree map so the output is sorted.
Map<Integer, Integer> windowValueMap = new TreeMap<>();
for(List<String> row : occurrencesTable.getRowsStartingFrom1()) {
int patternId = Integer.parseInt(row.get(1));
if(patternIds.contains(patternId)) {
windowValueMap.put(Integer.valueOf(row.get(0)), patternId);
}
}
}
private File generateOccurrencesFile(Table table, Table patternTable, int canalId) throws IOException {
List<List<String>> rows = table.getRowsStartingFrom1();
......
Supports Markdown
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