Skip to content

Commit

Permalink
Merge pull request #41 from hpxro7/bug/shuffle
Browse files Browse the repository at this point in the history
Fixed incorrect instance shuffling algorithm.
  • Loading branch information
Sentimentron committed Jun 6, 2014
2 parents e5a9ae4 + a54d473 commit 8cc8aea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions base/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"encoding/binary"
"errors"
"fmt"
"github.com/gonum/matrix/mat64"
"math/rand"

"github.com/gonum/matrix/mat64"
)

// SortDirection specifies sorting direction...
Expand Down Expand Up @@ -507,7 +508,7 @@ func (inst *Instances) GeneratePredictionVector() *Instances {
// Shuffle randomizes the row order in place
func (inst *Instances) Shuffle() {
for i := 0; i < inst.Rows; i++ {
j := rand.Intn(inst.Rows)
j := rand.Intn(i + 1)
inst.swapRows(i, j)
}
}
Expand Down

0 comments on commit 8cc8aea

Please sign in to comment.