1
0
mirror of https://github.com/sjwhitworth/golearn.git synced 2025-04-25 13:48:49 +08:00
golearn/base/dense_test.go
Richard Townsend 527c6476e1 Optimised version of KNN for Euclidean distances
This patch also:
   * Completes removal of the edf/ package
   * Corrects an erroneous print statement
   * Introduces two new CSV functions
      * ParseCSVToInstancesTemplated makes sure that
        reading a second CSV file maintains strict Attribute
        compatibility with an existing DenseInstances
      * ParseCSVToInstancesWithAttributeGroups gives more control
        over where Attributes end up in memory, important for
        gaining predictable control over the KNN optimisation
      * Decouples BinaryAttributeGroup from FixedAttributeGroup for
        better casting support
2014-09-30 23:10:22 +01:00

36 lines
987 B
Go

package base
import (
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestHighDimensionalInstancesLoad(t *testing.T) {
Convey("Given a high-dimensional dataset...", t, func() {
_, err := ParseCSVToInstances("../examples/datasets/mnist_train.csv", true)
So(err, ShouldEqual, nil)
})
}
func TestHighDimensionalInstancesLoad2(t *testing.T) {
Convey("Given a high-dimensional dataset...", t, func() {
// Create the class Attribute
classAttrs := make(map[int]Attribute)
classAttrs[0] = NewCategoricalAttribute()
classAttrs[0].SetName("Number")
// Setup the class Attribute to be in its own group
classAttrGroups := make(map[string]string)
classAttrGroups["Number"] = "ClassGroup"
// The rest can go in a default group
attrGroups := make(map[string]string)
_, err := ParseCSVToInstancesWithAttributeGroups(
"../examples/datasets/mnist_train.csv",
attrGroups,
classAttrGroups,
classAttrs,
true,
)
So(err, ShouldEqual, nil)
})
}