Changeset 1620 for branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
- Timestamp:
- 07/23/14 18:18:11 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/temporalrelation/SequenceForTaskDetectionRuleAlignment.java
r1619 r1620 26 26 27 27 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.AlignmentAlgorithmFactory; 28 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.Match; 28 29 import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence; 29 30 import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.PairwiseAlignmentGenerator; … … 155 156 Console.traceln(Level.INFO,"generating substitution matrix"); 156 157 ObjectDistanceSubstitionMatrix submat = new ObjectDistanceSubstitionMatrix( 157 uniqueTasks, 5);158 uniqueTasks, 6,-3); 158 159 submat.generate(); 159 160 160 161 Console.traceln(Level.INFO,"generating pairwise alignments"); 161 ArrayList< ArrayList<NumberSequence>> matchseqs = new ArrayList<ArrayList<NumberSequence>>();162 PairwiseAlignmentStorage alignments = PairwiseAlignmentGenerator.generate(numberseqs,submat );162 ArrayList<Match> matchseqs = new ArrayList<Match>(); 163 PairwiseAlignmentStorage alignments = PairwiseAlignmentGenerator.generate(numberseqs,submat,9); 163 164 164 165 Console.traceln(Level.INFO,"retrieving significant sequence pieces"); … … 167 168 for(int j=0; j< numberseqs.size();j++) { 168 169 if(i != j) { 169 ArrayList<ArrayList<NumberSequence>> tmp = alignments.get(i, j).getMatches(); 170 matchseqs.addAll(tmp); 170 matchseqs.addAll(alignments.get(i, j).getMatches()); 171 171 } 172 172 } … … 178 178 //search this match in every other sequence 179 179 for(int i=0; i < matchseqs.size();i++) { 180 int occurencecount = 0; 180 int sequencecount = 0; 181 int totalcount = 0; 182 Match pattern = matchseqs.get(i); 183 184 185 186 //Skip sequences with more 0 events (scrolls) than other events. Both of the pattern sequences are equally long, so the added 0 counts 187 //just need to be smaller than the length of one sequence 188 if(pattern.getFirstSequence().eventCount(0) + pattern.getSecondSequence().eventCount(0) +1 > pattern.getFirstSequence().size()) 189 continue; 181 190 Console.traceln(Level.FINEST, "searching for patterns occuring most: " + Math.round((float)i/(float)matchseqs.size()*100) + "%"); 182 for(int j=0; j < matchseqs.size();j++) { 183 if(i>j) { 184 if(matchseqs.get(j).get(0).containsPattern(matchseqs.get(i)) > 0 || matchseqs.get(j).get(1).containsPattern(matchseqs.get(i)) > 0) { 185 occurencecount++; 191 for(int j=0; j < numberseqs.size();j++) { 192 int tmpcount = numberseqs.get(j).containsPattern(pattern); 193 if(tmpcount > 0) { 194 sequencecount++; 195 totalcount+=tmpcount; 186 196 } 187 } 188 } 189 if(occurencecount > 1) { 190 System.out.println("Found pattern \n "); 191 matchseqs.get(i).get(0).printSequence(); 192 matchseqs.get(i).get(1).printSequence(); 193 System.out.println(occurencecount + " times"); 197 } 198 199 if(totalcount > 1) { 200 matchseqs.get(i).getFirstSequence().printSequence(); 201 matchseqs.get(i).getFirstSequence().printSequence(); 202 System.out.println("Found pattern in " + sequencecount +"/" + numberseqs.size() + " sequences, total of " + totalcount + " occurences"); 194 203 System.out.println(); 195 204 } 196 205 } 197 198 199 200 206 alignments = null; 201 207 … … 290 296 } 291 297 } 298 templist.setId(numberseqs.size()); 292 299 numberseqs.add(templist); 293 300 comparator.clearBuffers();
Note: See TracChangeset
for help on using the changeset viewer.