Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
Fixed a bug in RandomDropoutAmplifier
Browse files Browse the repository at this point in the history
  • Loading branch information
myui committed Nov 22, 2013
1 parent 23b4f3b commit 54db89c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/hivemall/common/RandomDropoutAmplifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
public class RandomDropoutAmplifier<T> {

private final int numBuffers;
private final int lastPos;
private final int xtimes;

private final AgedObject<T>[][] slots;
Expand All @@ -48,7 +47,6 @@ public RandomDropoutAmplifier(int numBuffers, int xtimes) {
throw new IllegalArgumentException("xtime must be greater than 0: " + xtimes);
}
this.numBuffers = numBuffers;
this.lastPos = numBuffers - 1;
this.xtimes = xtimes;
this.slots = new AgedObject[xtimes][numBuffers];
this.position = 0;
Expand Down Expand Up @@ -77,8 +75,8 @@ public void add(T storedObj) throws HiveException {
for(int x = 0; x < xtimes; x++) {
AgedObject<T>[] slot = slots[x];
Random rnd = randoms[x];
int rindex1 = rnd.nextInt(lastPos);
int rindex2 = rnd.nextInt(lastPos);
int rindex1 = rnd.nextInt(numBuffers);
int rindex2 = rnd.nextInt(numBuffers);
AgedObject<T> replaced1 = slot[rindex1];
AgedObject<T> replaced2 = slot[rindex2];
assert (replaced1 != null);
Expand Down

0 comments on commit 54db89c

Please sign in to comment.