Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed incorrect instance shuffling algorithm. #41

Merged
merged 1 commit into from
Jun 6, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how pedantic we are with these but this is diff noise that can be fixed by gofmt.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is because some people use gofmt while others use goimport. The order of the two package is somehow a little different.
Personally, I use goimport becasue it can also handle import.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go test passes on my machine.

As far as the diff noise goes, @lazywei is right, I do use goimport. As a side note, gofmt does not seem to collapse the empty blankline space between the local/external package imports if its already there.

)

// 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