Skip to content

Commit 4e4ec42

Browse files
committed
use same random seed for shuffling feature vectors.
1 parent eed7ae9 commit 4e4ec42

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

java/codebuff.ipr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<profile default="true" name="Default" enabled="false">
1818
<processorPath useClasspath="true" />
1919
</profile>
20-
<profile default="false" name="Annotation profile for codebuff" enabled="true">
20+
<profile default="false" name="Maven default annotation processors profile" enabled="true">
2121
<sourceOutputDir name="target/generated-sources/annotations" />
2222
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
2323
<outputRelativeToContentRoot value="true" />

java/src/org/antlr/codebuff/Corpus.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import java.util.Random;
1010

1111
public class Corpus {
12+
public static final int FEATURE_VECTOR_RANDOM_SEED = 314159; // need randomness but use same seed to get reproducibility
13+
1214
public static final int NUM_DEPENDENT_VARS = 3;
1315
public static final int INDEX_FEATURE_NEWLINES = 0;
1416
public static final int INDEX_FEATURE_WS = 1;
@@ -51,6 +53,7 @@ public Corpus(List<InputDocument> documents,
5153
*/
5254
public void randomShuffleInPlace() {
5355
Random r = new Random();
56+
r.setSeed(FEATURE_VECTOR_RANDOM_SEED);
5457
// for i from n−1 downto 1 do
5558
int n = X.size();
5659
for (int i=n-1; i>=1; i--) {

0 commit comments

Comments
 (0)