Beispiel #1
0
        public float[] PredictRaw(float[][] data)
        {
            var test = new DMatrix(data);

            return(booster.Predict(test));
        }
Beispiel #2
0
        //public XGBClassifier(IDictionary<string, object> p_parameters)
        //{
        //    parameters = p_parameters;
        //}

        /// <summary>
        ///   Fit the gradient boosting model
        /// </summary>
        /// <param name="data">
        ///   Feature matrix
        /// </param>
        /// <param name="labels">
        ///   Labels
        /// </param>
        public void Fit(float[][] data, float[] labels)
        {
            var train = new DMatrix(data, labels);

            booster = Train(parameters, train, ((int)parameters["n_estimators"]));
        }
Beispiel #3
0
        /// <summary>
        ///   Predict using the gradient boosted model
        /// </summary>
        /// <param name="data">
        ///   Feature matrix to do predicitons on
        /// </param>
        /// <returns>
        ///   Predictions
        /// </returns>
        public float[] Predict(float[][] data)
        {
            var test = new DMatrix(data);

            return(booster.Predict(test).Select(v => v > 0.5f ? 1f : 0f).ToArray());
        }
 public void Init(float[][] data, float[] labels)
 {
     XGBTrain = new DMatrix(data, labels);
     booster  = new Booster(XGBTrain);
     booster.SetParametersGeneric(parameters);
 }