@@ -109,35 +109,38 @@ public void distributedLDAModel() {
109
109
assert (model .logPrior () < 0.0 );
110
110
}
111
111
112
-
113
112
@ Test
114
113
public void OnlineOptimizerCompatibility () {
115
- int k = 3 ;
116
- double topicSmoothing = 1.2 ;
117
- double termSmoothing = 1.2 ;
118
-
119
- // Train a model
120
- OnlineLDAOptimizer op = new OnlineLDAOptimizer ().setTau_0 (1024 ).setKappa (0.51 )
121
- .setGammaShape (1e40 ).setMiniBatchFraction (0.5 );
122
- LDA lda = new LDA ();
123
- lda .setK (k )
124
- .setDocConcentration (topicSmoothing )
125
- .setTopicConcentration (termSmoothing )
126
- .setMaxIterations (5 )
127
- .setSeed (12345 )
128
- .setOptimizer (op );
129
-
130
- LDAModel model = lda .run (corpus );
131
-
132
- // Check: basic parameters
133
- assertEquals (model .k (), k );
134
- assertEquals (model .vocabSize (), tinyVocabSize );
135
-
136
- // Check: topic summaries
137
- Tuple2 <int [], double []>[] roundedTopicSummary = model .describeTopics ();
138
- assertEquals (roundedTopicSummary .length , k );
139
- Tuple2 <int [], double []>[] roundedLocalTopicSummary = model .describeTopics ();
140
- assertEquals (roundedLocalTopicSummary .length , k );
114
+ int k = 3 ;
115
+ double topicSmoothing = 1.2 ;
116
+ double termSmoothing = 1.2 ;
117
+
118
+ // Train a model
119
+ OnlineLDAOptimizer op = new OnlineLDAOptimizer ()
120
+ .setTau_0 (1024 )
121
+ .setKappa (0.51 )
122
+ .setGammaShape (1e40 )
123
+ .setMiniBatchFraction (0.5 );
124
+
125
+ LDA lda = new LDA ();
126
+ lda .setK (k )
127
+ .setDocConcentration (topicSmoothing )
128
+ .setTopicConcentration (termSmoothing )
129
+ .setMaxIterations (5 )
130
+ .setSeed (12345 )
131
+ .setOptimizer (op );
132
+
133
+ LDAModel model = lda .run (corpus );
134
+
135
+ // Check: basic parameters
136
+ assertEquals (model .k (), k );
137
+ assertEquals (model .vocabSize (), tinyVocabSize );
138
+
139
+ // Check: topic summaries
140
+ Tuple2 <int [], double []>[] roundedTopicSummary = model .describeTopics ();
141
+ assertEquals (roundedTopicSummary .length , k );
142
+ Tuple2 <int [], double []>[] roundedLocalTopicSummary = model .describeTopics ();
143
+ assertEquals (roundedLocalTopicSummary .length , k );
141
144
}
142
145
143
146
private static int tinyK = LDASuite$ .MODULE$ .tinyK ();
0 commit comments