private readonly double _sigmoidParameter; // Parameter for scaling the loss

            public ObjectiveImpl(
                Dataset trainSet,
                bool[] trainSetLabels,
                double learningRate,
                double shrinkage,
                double sigmoidParameter,
                bool unbalancedSets,
                double maxTreeOutput,
                int getDerivativesSampleRate,
                bool bestStepRankingRegressionTrees,
                int rngSeed,
                IParallelTraining parallelTraining)
                : base(
                    trainSet,
                    learningRate,
                    shrinkage,
                    maxTreeOutput,
                    getDerivativesSampleRate,
                    bestStepRankingRegressionTrees,
                    rngSeed)
            {
                _sigmoidParameter = sigmoidParameter;
                _labels           = trainSetLabels;
                _unbalancedSets   = unbalancedSets;
                if (_unbalancedSets)
                {
                    BinaryClassificationTest.ComputeExampleCounts(_labels, out _npos, out _nneg);
                    Contracts.Check(_nneg > 0 && _npos > 0, "Only one class in training set.");
                }
                _parallelTraining = parallelTraining;
            }
예제 #2
0
 public ObjectiveImpl(Dataset trainSet, bool[] trainSetLabels, BinaryClassificationGamTrainer.Arguments args)
     : base(
         trainSet,
         args.LearningRates,
         0,
         args.MaxOutput,
         args.GetDerivativesSampleRate,
         false,
         args.RngSeed)
 {
     _labels         = trainSetLabels;
     _unbalancedSets = args.UnbalancedSets;
     if (_unbalancedSets)
     {
         BinaryClassificationTest.ComputeExampleCounts(_labels, out _npos, out _nneg);
         Contracts.Check(_nneg > 0 && _npos > 0, "Only one class in training set.");
     }
 }
예제 #3
0
 public ObjectiveImpl(Dataset trainSet, bool[] trainSetLabels, Arguments args, IParallelTraining parallelTraining)
     : base(
         trainSet,
         args.LearningRates,
         args.Shrinkage,
         args.MaxTreeOutput,
         args.GetDerivativesSampleRate,
         args.BestStepRankingRegressionTrees,
         args.RngSeed)
 {
     _labels         = trainSetLabels;
     _unbalancedSets = args.UnbalancedSets;
     if (_unbalancedSets)
     {
         BinaryClassificationTest.ComputeExampleCounts(_labels, out _npos, out _nneg);
         Contracts.Check(_nneg > 0 && _npos > 0, "Only one class in training set.");
     }
     _parallelTraining = parallelTraining;
 }