Exemplo n.º 1
0
        public void Test32BitEquality()
        {
            var r = CrossValidation.TrainTestSplit(new[]
            {
                boston.Data,
                boston.Target.ToColumnMatrix()
            },
                                                   randomState: new Random(1));

            Matrix <double> xTrain = r[0].Item1;
            Matrix <double> xTest  = r[0].Item2;

            Vector <double> yTrain = r[1].Item1.Column(0);
            Vector <double> yTest  = r[1].Item2.Column(0);
            var             est    = new DecisionTreeRegressor(random: new Random(1));

            //var xstr = string.Join("\n", xTrain.RowEnumerator().Select(v => string.Join(",", v.Item2) ));
            //var ystr = "[" + string.Join(",", yTrain) + "]";

            est.Fit(xTrain, yTrain);
            double score = est.Score(xTest, yTest);

            Assert.AreEqual(0.74776186837750824, score, 1E-10);
        }