Commit 1b04826e9c8d19c7e829cb9b9261112b8918d6b3
1 parent
c9b1021d
release
Showing
3 changed files
with
14 additions
and
0 deletions
nicolas-train/src/main/java/pl/waw/ipipan/zil/summ/nicolas/eval/SummarizeTestCorpus.java
@@ -57,7 +57,11 @@ public class SummarizeTestCorpus { | @@ -57,7 +57,11 @@ public class SummarizeTestCorpus { | ||
57 | 57 | ||
58 | private static Map<String, String> summarizeTexts(Map<String, TText> id2preprocessedText, Nicolas nicolas) throws NicolasException { | 58 | private static Map<String, String> summarizeTexts(Map<String, TText> id2preprocessedText, Nicolas nicolas) throws NicolasException { |
59 | Map<String, String> id2summary = Maps.newHashMap(); | 59 | Map<String, String> id2summary = Maps.newHashMap(); |
60 | + int textNumber = 0; | ||
60 | for (Map.Entry<String, TText> entry : id2preprocessedText.entrySet()) { | 61 | for (Map.Entry<String, TText> entry : id2preprocessedText.entrySet()) { |
62 | + if (textNumber++ % 10 == 0) { | ||
63 | + LOG.info("{} texts summarized.", textNumber); | ||
64 | + } | ||
61 | TText text = entry.getValue(); | 65 | TText text = entry.getValue(); |
62 | int targetSize = calculateTargetSize(text); | 66 | int targetSize = calculateTargetSize(text); |
63 | String summary = nicolas.summarizeThrift(text, targetSize); | 67 | String summary = nicolas.summarizeThrift(text, targetSize); |
nicolas-train/src/main/java/pl/waw/ipipan/zil/summ/nicolas/train/model/Settings.java
@@ -4,6 +4,7 @@ import weka.classifiers.Classifier; | @@ -4,6 +4,7 @@ import weka.classifiers.Classifier; | ||
4 | import weka.classifiers.meta.AttributeSelectedClassifier; | 4 | import weka.classifiers.meta.AttributeSelectedClassifier; |
5 | import weka.classifiers.trees.LMT; | 5 | import weka.classifiers.trees.LMT; |
6 | import weka.classifiers.trees.RandomForest; | 6 | import weka.classifiers.trees.RandomForest; |
7 | +import weka.classifiers.trees.RandomTree; | ||
7 | 8 | ||
8 | public class Settings { | 9 | public class Settings { |
9 | 10 | ||
@@ -16,6 +17,10 @@ public class Settings { | @@ -16,6 +17,10 @@ public class Settings { | ||
16 | 17 | ||
17 | public static Classifier getMentionClassifier() { | 18 | public static Classifier getMentionClassifier() { |
18 | RandomForest classifier = new RandomForest(); | 19 | RandomForest classifier = new RandomForest(); |
20 | + RandomTree tree = new RandomTree(); | ||
21 | + tree.setMaxDepth(10); | ||
22 | + tree.setMinNum(2); | ||
23 | + classifier.setClassifier(tree); | ||
19 | classifier.setNumIterations(NUM_ITERATIONS); | 24 | classifier.setNumIterations(NUM_ITERATIONS); |
20 | classifier.setSeed(SEED); | 25 | classifier.setSeed(SEED); |
21 | classifier.setNumExecutionSlots(NUM_EXECUTION_SLOTS); | 26 | classifier.setNumExecutionSlots(NUM_EXECUTION_SLOTS); |
@@ -24,6 +29,10 @@ public class Settings { | @@ -24,6 +29,10 @@ public class Settings { | ||
24 | 29 | ||
25 | public static Classifier getSentenceClassifier() { | 30 | public static Classifier getSentenceClassifier() { |
26 | RandomForest classifier = new RandomForest(); | 31 | RandomForest classifier = new RandomForest(); |
32 | + RandomTree tree = new RandomTree(); | ||
33 | + tree.setMaxDepth(10); | ||
34 | + tree.setMinNum(2); | ||
35 | + classifier.setClassifier(tree); | ||
27 | classifier.setNumIterations(NUM_ITERATIONS); | 36 | classifier.setNumIterations(NUM_ITERATIONS); |
28 | classifier.setSeed(SEED); | 37 | classifier.setSeed(SEED); |
29 | classifier.setNumExecutionSlots(NUM_EXECUTION_SLOTS); | 38 | classifier.setNumExecutionSlots(NUM_EXECUTION_SLOTS); |
nicolas-train/src/main/java/pl/waw/ipipan/zil/summ/nicolas/train/pipeline/TrainAllModels.java
@@ -44,6 +44,7 @@ public class TrainAllModels { | @@ -44,6 +44,7 @@ public class TrainAllModels { | ||
44 | LOG.info("Building classifier..."); | 44 | LOG.info("Building classifier..."); |
45 | classifier.buildClassifier(instances); | 45 | classifier.buildClassifier(instances); |
46 | LOG.info("...done. Build classifier: {}", classifier); | 46 | LOG.info("...done. Build classifier: {}", classifier); |
47 | + instances.clear(); | ||
47 | 48 | ||
48 | String target = TARGET_MODEL_DIR + targetPath; | 49 | String target = TARGET_MODEL_DIR + targetPath; |
49 | LOG.info("Saving classifier at: {}", target); | 50 | LOG.info("Saving classifier at: {}", target); |