1
0
mirror of https://github.com/sjwhitworth/golearn.git synced 2025-04-25 13:48:49 +08:00

Add test cases for C1

This commit is contained in:
ss8651twtw 2018-06-05 18:53:08 +08:00
parent 233c51381c
commit 2b597df94c

View File

@ -104,3 +104,13 @@ func TestMatrixAndVectorMismatchDim(t *testing.T) {
So(func() { matrixSubVector(X, v) }, ShouldPanic)
})
}
func TestPCAComponentBiggerThanFeature(t *testing.T) {
Convey("Set to pca 5 components with 3x3 matrix", t, func() {
X := mat.NewDense(3, 3, []float64{-3, 0, 1, 55, 2, 9, -9, 3, 66})
pca := NewPCA(5)
rows, cols := pca.FitTransform(X).Dims()
So(rows, ShouldEqual, 3)
So(cols, ShouldEqual, 3)
})
}