/// <summary>
 /// Initializes a new instance of <see cref="LbfgsLogisticRegressionBinaryTrainer"/>
 /// </summary>
 internal LbfgsLogisticRegressionBinaryTrainer(IHostEnvironment env, Options options)
     : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName))
 {
     _posWeight        = 0;
     ShowTrainingStats = LbfgsTrainerOptions.ShowTrainingStatistics;
 }
Esempio n. 2
0
        private RandomizedPcaTrainer(IHostEnvironment env, Options options, string featureColumnName, string exampleWeightColumnName,
                                     int rank = 20, int oversampling = 20, bool center = true, int?seed = null)
            : base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), TrainerUtils.MakeR4VecFeature(featureColumnName), default, TrainerUtils.MakeR4ScalarWeightColumn(exampleWeightColumnName))
        {
            // if the args are not null, we got here from maml, and the internal ctor.
            if (options != null)
            {
                _rank           = options.Rank;
                _ensureZeroMean = options.EnsureZeroMean;
                _oversampling   = options.Oversampling;
                _seed           = options.Seed ?? Host.Rand.Next();
            }
            else
            {
                _rank           = rank;
                _ensureZeroMean = center;
                _oversampling   = oversampling;
                _seed           = seed ?? Host.Rand.Next();
            }

            _featureColumn = featureColumnName;

            Host.CheckUserArg(_rank > 0, nameof(_rank), "Rank must be positive");
            Host.CheckUserArg(_oversampling >= 0, nameof(_oversampling), "Oversampling must be non-negative");
        }
 /// <summary>
 /// Initializes a new instance of <see cref="PoissonRegression"/>
 /// </summary>
 internal PoissonRegression(IHostEnvironment env, Options options)
     : base(env, options, TrainerUtils.MakeR4ScalarColumn(options.LabelColumn))
 {
 }
 /// <summary>
 /// Initializes a new instance of <see cref="PoissonRegression"/>
 /// </summary>
 internal PoissonRegression(IHostEnvironment env, Arguments args)
     : base(env, args, TrainerUtils.MakeR4ScalarLabel(args.LabelColumn))
 {
 }
Esempio n. 5
0
 internal AveragedPerceptronTrainer(IHostEnvironment env, Options options)
     : base(options, env, UserNameValue, TrainerUtils.MakeBoolScalarLabel(options.LabelColumnName))
 {
     _args        = options;
     LossFunction = _args.LossFunction ?? _args.LossFunctionFactory.CreateComponent(env);
 }
 /// <summary>
 /// Initializes a new instance of <see cref="MultiClassNaiveBayesTrainer"/>
 /// </summary>
 internal MultiClassNaiveBayesTrainer(IHostEnvironment env, Options options)
     : base(Contracts.CheckRef(env, nameof(env)).Register(LoadName), TrainerUtils.MakeR4VecFeature(options.FeatureColumnName),
            TrainerUtils.MakeU4ScalarColumn(options.LabelColumnName))
 {
     Host.CheckValue(options, nameof(options));
 }
 /// <summary>
 /// Initializes a new instance of <see cref="LogisticRegression"/>
 /// </summary>
 internal LogisticRegression(IHostEnvironment env, Options options)
     : base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn))
 {
     _posWeight        = 0;
     ShowTrainingStats = Args.ShowTrainingStats;
 }
 internal OnlineGradientDescentTrainer(IHostEnvironment env, Options options)
     : base(options, env, UserNameValue, TrainerUtils.MakeR4ScalarColumn(options.LabelColumnName))
 {
     LossFunction = options.LossFunction ?? options.LossFunctionFactory.CreateComponent(env);
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of <see cref="MulticlassLogisticRegression"/>
 /// </summary>
 internal MulticlassLogisticRegression(IHostEnvironment env, Options options)
     : base(env, options, TrainerUtils.MakeU4ScalarColumn(options.LabelColumn))
 {
     ShowTrainingStats = Args.ShowTrainingStats;
 }
 /// <summary>
 /// Initializes a new instance of <see cref="LogisticRegressionMulticlassClassificationTrainer"/>
 /// </summary>
 internal LogisticRegressionMulticlassClassificationTrainer(IHostEnvironment env, Options options)
     : base(env, options, TrainerUtils.MakeU4ScalarColumn(options.LabelColumnName))
 {
     ShowTrainingStats = LbfgsTrainerOptions.ShowTrainingStatistics;
 }