/// <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)); }
/// <summary> /// Initializes a new instance of <see cref="MulticlassLogisticRegression"/> /// </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> /// <param name="weightColumn">The name for the example weight column.</param> /// <param name="advancedSettings">A delegate to apply all the advanced arguments to the algorithm.</param> public MulticlassLogisticRegression(IHostEnvironment env, string featureColumn, string labelColumn, string weightColumn = null, Action <Arguments> advancedSettings = null) : base(env, featureColumn, TrainerUtils.MakeU4ScalarLabel(labelColumn), weightColumn, advancedSettings) { Host.CheckNonEmpty(featureColumn, nameof(featureColumn)); Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); ShowTrainingStats = Args.ShowTrainingStats; }
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; }
public SdcaMultiClassTrainer(IHostEnvironment env, Arguments args, string featureColumn, string labelColumn, string weightColumn = null) : base(Contracts.CheckRef(env, nameof(env)).Register(LoadNameValue), args, TrainerUtils.MakeR4VecFeature(featureColumn), TrainerUtils.MakeU4ScalarLabel(labelColumn), TrainerUtils.MakeR4ScalarWeightColumn(weightColumn)) { Host.CheckValue(labelColumn, nameof(labelColumn)); Host.CheckValue(featureColumn, nameof(featureColumn)); _loss = args.LossFunction.CreateComponent(env); Loss = _loss; _args = args; }
/// <summary> /// Initializes a new instance of <see cref="MulticlassLogisticRegression"/> /// </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> /// <param name="weightColumn">The name for the example weight column.</param> /// <param name="enforceNoNegativity">Enforce non-negative weights.</param> /// <param name="l1Weight">Weight of L1 regularizer term.</param> /// <param name="l2Weight">Weight of L2 regularizer term.</param> /// <param name="memorySize">Memory size for <see cref="LogisticRegression"/>. Lower=faster, less accurate.</param> /// <param name="optimizationTolerance">Threshold for optimizer convergence.</param> /// <param name="advancedSettings">A delegate to apply all the advanced arguments to the algorithm.</param> public MulticlassLogisticRegression(IHostEnvironment env, string featureColumn, string labelColumn, string weightColumn = null, float l1Weight = Arguments.Defaults.L1Weight, float l2Weight = Arguments.Defaults.L2Weight, float optimizationTolerance = Arguments.Defaults.OptTol, int memorySize = Arguments.Defaults.MemorySize, bool enforceNoNegativity = Arguments.Defaults.EnforceNonNegativity, Action <Arguments> advancedSettings = null) : base(env, featureColumn, TrainerUtils.MakeU4ScalarLabel(labelColumn), weightColumn, advancedSettings, l1Weight, l2Weight, optimizationTolerance, memorySize, enforceNoNegativity) { Host.CheckNonEmpty(featureColumn, nameof(featureColumn)); Host.CheckNonEmpty(labelColumn, nameof(labelColumn)); ShowTrainingStats = Args.ShowTrainingStats; }
/// <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; }
/// <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)); }
/// <summary> /// Initializes a new instance of <see cref="MulticlassLogisticRegression"/> /// </summary> internal MulticlassLogisticRegression(IHostEnvironment env, Arguments args) : base(env, args, TrainerUtils.MakeU4ScalarLabel(args.LabelColumn)) { ShowTrainingStats = Args.ShowTrainingStats; }