public void TestLoad()
        {
            var res = DiabetesDataset.Load();

            Assert.AreEqual(res.Data.Shape(), Tuple.Create(442, 10));
            Assert.AreEqual(res.Target.Count, 442);
        }
Beispiel #2
0
        public void TestInitialize()
        {
            var diabetes = DiabetesDataset.Load();

            xDiabetes = diabetes.Data.SubMatrix(0, 200, 0, diabetes.Data.ColumnCount);
            yDiabetes = MatrixExtensions.ToColumnMatrix(diabetes.Target.SubVector(0, 200));
            //ind = np.arange(X_diabetes.shape[0])
            //Random rng = new Random(0);
            //rng.shuffle(ind)
            //ind = ind[:200]
            //X_diabetes, y_diabetes = X_diabetes[ind], y_diabetes[ind]
            var iris = IrisDataset.Load();

            xIris = SparseMatrix.OfMatrix(iris.Data);
            yIris = iris.Target;
        }
Beispiel #3
0
        [Ignore] //This test is ignored in scikit-learn also.
        public void TestBayesianOnDiabetes()
        {
            //raise SkipTest("XFailed Test")
            var diabetes = DiabetesDataset.Load();
            var x        = diabetes.Data;
            var y        = diabetes.Target;

            var clf = new BayesianRidgeRegression(computeScore: true);

            // Test with more samples than features
            clf.Fit(x, y);
            // Test that scores are increasing at each iteration
            Assert.AreEqual(clf.Scores.Count - 1, clf.Scores.Diff().Count(v => v > 0));

            // Test with more features than samples
            x = x.SubMatrix(0, 5, 0, x.ColumnCount);
            y = y.SubVector(0, 5);
            clf.Fit(x, y);
            // Test that scores are increasing at each iteration
            Assert.AreEqual(clf.Scores.Count - 1, clf.Scores.Diff().Count(v => v > 0));
        }