Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add benchmark #53

Merged
merged 1 commit into from

2 participants

@njern
Collaborator

Forgot to add this benchmark to PR #52

@sjwhitworth sjwhitworth merged commit 0eff413 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 20, 2014
  1. @njern

    Add benchmark

    njern authored
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 0 deletions.
  1. +13 −0 linear_models/linear_regression_test.go
View
13 linear_models/linear_regression_test.go
@@ -58,3 +58,16 @@ func TestLinearRegression(t *testing.T) {
fmt.Printf("Expected: %f || Predicted: %f\n", testData.Get(i, testData.ClassIndex), predictions.Get(i, predictions.ClassIndex))
}
}
+
+func BenchmarkLinearRegressionOneRow(b *testing.B) {
+ // Omits error handling in favor of brevity
+ trainData, _ := base.ParseCSVToInstances("../examples/datasets/exams.csv", true)
+ testData, _ := base.ParseCSVToInstances("../examples/datasets/exam.csv", true)
+ lr := NewLinearRegression()
+ lr.Fit(trainData)
+
+ b.ResetTimer()
+ for n := 0; n < b.N; n++ {
+ lr.Predict(testData)
+ }
+}
Something went wrong with that request. Please try again.