Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of <see cref="MultiClassNaiveBayesTrainer"/>
 /// </summary>
 /// <param name="env">The environment to use.</param>
 /// <param name="labelColumn">The name of the label column.</param>
 /// <param name="featureColumn">The name of the feature column.</param>
 public MultiClassNaiveBayesTrainer(IHostEnvironment env, string featureColumn, string labelColumn)
     : base(Contracts.CheckRef(env, nameof(env)).Register(LoadName), TrainerUtils.MakeR4VecFeature(featureColumn),
            TrainerUtils.MakeU4ScalarLabel(labelColumn))
 {
     Host.CheckNonEmpty(featureColumn, nameof(featureColumn));
     Host.CheckNonEmpty(labelColumn, nameof(labelColumn));
 }
Esempio n. 2
0
        internal SdcaMultiClassTrainer(IHostEnvironment env, Arguments args,
                                       string featureColumn, string labelColumn, string weightColumn = null)
            : base(env, args, TrainerUtils.MakeU4ScalarLabel(labelColumn), TrainerUtils.MakeR4ScalarWeightColumn(weightColumn))
        {
            Host.CheckValue(labelColumn, nameof(labelColumn));
            Host.CheckValue(featureColumn, nameof(featureColumn));

            _loss = args.LossFunction.CreateComponent(env);
            Loss  = _loss;
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of <see cref="SdcaMultiClassTrainer"/>
 /// </summary>
 /// <param name="env">The environment to use.</param>
 /// <param name="featureColumn">The features, or independent variables.</param>
 /// <param name="labelColumn">The label, or dependent variable.</param>
 /// <param name="loss">The custom loss.</param>
 /// <param name="weightColumn">The optional example weights.</param>
 /// <param name="l2Const">The L2 regularization hyperparameter.</param>
 /// <param name="l1Threshold">The L1 regularization hyperparameter. Higher values will tend to lead to more sparse model.</param>
 /// <param name="maxIterations">The maximum number of passes to perform over the data.</param>
 /// <param name="advancedSettings">A delegate to set more settings.</param>
 public SdcaMultiClassTrainer(IHostEnvironment env,
                              string featureColumn,
                              string labelColumn,
                              string weightColumn = null,
                              ISupportSdcaClassificationLoss loss = null,
                              float?l2Const     = null,
                              float?l1Threshold = null,
                              int?maxIterations = null,
                              Action <Arguments> advancedSettings = null)
     : base(env, featureColumn, TrainerUtils.MakeU4ScalarLabel(labelColumn), TrainerUtils.MakeR4ScalarWeightColumn(weightColumn), advancedSettings,
            l2Const, l1Threshold, maxIterations)
 {
     Host.CheckNonEmpty(featureColumn, nameof(featureColumn));
     Host.CheckNonEmpty(labelColumn, nameof(labelColumn));
     _loss = loss ?? Args.LossFunction.CreateComponent(env);
     Loss  = _loss;
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of <see cref="MultiClassNaiveBayesTrainer"/>
 /// </summary>
 internal MultiClassNaiveBayesTrainer(IHostEnvironment env, Arguments args)
     : base(Contracts.CheckRef(env, nameof(env)).Register(LoadName), TrainerUtils.MakeR4VecFeature(args.FeatureColumn),
            TrainerUtils.MakeU4ScalarLabel(args.LabelColumn))
 {
     Host.CheckValue(args, nameof(args));
 }