/// <summary> /// Create <see cref= "SymbolicSgdLogisticRegressionBinaryTrainer" /> with advanced options, which predicts a target using a linear binary classification model trained over boolean label data. /// Stochastic gradient descent (SGD) is an iterative algorithm that optimizes a differentiable objective function. /// The <see cref="SymbolicSgdLogisticRegressionBinaryTrainer"/> parallelizes SGD using <a href="https://www.microsoft.com/en-us/research/project/project-parade/#!symbolic-execution">symbolic execution</a>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="options">Algorithm advanced options. See <see cref="SymbolicSgdLogisticRegressionBinaryTrainer.Options"/>.</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[SymbolicSgdLogisticRegression](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/SymbolicSgdLogisticRegressionWithOptions.cs)] /// ]]> /// </format> /// </example> public static SymbolicSgdLogisticRegressionBinaryTrainer SymbolicSgdLogisticRegression( this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, SymbolicSgdLogisticRegressionBinaryTrainer.Options options) { Contracts.CheckValue(catalog, nameof(catalog)); Contracts.CheckValue(options, nameof(options)); var env = CatalogUtils.GetEnvironment(catalog); return(new SymbolicSgdLogisticRegressionBinaryTrainer(env, options)); }
/// <summary> /// Predict a target using a linear binary classification model trained with the <see cref="SymSgdClassificationTrainer"/>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="options">Algorithm advanced options. See <see cref="SymSgdClassificationTrainer.Options"/>.</param> public static SymSgdClassificationTrainer SymbolicStochasticGradientDescent( this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, SymSgdClassificationTrainer.Options options) { Contracts.CheckValue(catalog, nameof(catalog)); Contracts.CheckValue(options, nameof(options)); var env = CatalogUtils.GetEnvironment(catalog); return(new SymSgdClassificationTrainer(env, options)); }
/// <summary> /// Predict a target using a decision tree binary classification model trained with the <see cref="FastTreeBinaryClassificationTrainer"/>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="options">Algorithm advanced settings.</param> public static FastTreeBinaryClassificationTrainer FastTree(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, FastTreeBinaryClassificationTrainer.Options options) { Contracts.CheckValue(catalog, nameof(catalog)); Contracts.CheckValue(options, nameof(options)); var env = CatalogUtils.GetEnvironment(catalog); return(new FastTreeBinaryClassificationTrainer(env, options)); }
/// <summary> /// Predict a target using a linear binary classification model trained with <see cref="AveragedPerceptronTrainer"/> and advanced options. /// </summary> /// <param name="catalog">The binary classification catalog trainer object.</param> /// <param name="options">Trainer options.</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[AveragedPerceptron](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/AveragedPerceptronWithOptions.cs)] /// ]]> /// </format> /// </example> public static AveragedPerceptronTrainer AveragedPerceptron( this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, AveragedPerceptronTrainer.Options options) { Contracts.CheckValue(catalog, nameof(catalog)); Contracts.CheckValue(options, nameof(options)); var env = CatalogUtils.GetEnvironment(catalog); return(new AveragedPerceptronTrainer(env, options)); }
/// <summary> /// Predict a target using a linear binary classification model trained with the SDCA trainer. /// </summary> /// <param name="catalog">The binary classification catalog trainer object.</param> /// <param name="options">Advanced arguments to the algorithm.</param> public static SdcaNonCalibratedBinaryTrainer StochasticDualCoordinateAscentNonCalibrated( this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, SdcaNonCalibratedBinaryTrainer.Options options) { Contracts.CheckValue(catalog, nameof(catalog)); Contracts.CheckValue(options, nameof(options)); var env = CatalogUtils.GetEnvironment(catalog); return(new SdcaNonCalibratedBinaryTrainer(env, options)); }
/// <summary> /// Predict a target using a decision tree regression model trained with the <see cref="FastForestClassification"/>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="labelColumn">The labelColumn column.</param> /// <param name="featureColumn">The featureColumn column.</param> /// <param name="weights">The optional weights column.</param> /// <param name="numTrees">Total number of decision trees to create in the ensemble.</param> /// <param name="numLeaves">The maximum number of leaves per decision tree.</param> /// <param name="minDatapointsInLeaves">The minimal number of datapoints allowed in a leaf of the tree, out of the subsampled data.</param> public static FastForestClassification FastForest(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weights = null, int numLeaves = Defaults.NumLeaves, int numTrees = Defaults.NumTrees, int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new FastForestClassification(env, labelColumn, featureColumn, weights, numLeaves, numTrees, minDatapointsInLeaves)); }
/// <summary> /// Predict a target using a decision tree binary classification model trained with the <see cref="LightGbmBinaryTrainer"/>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="labelColumn">The labelColumn column.</param> /// <param name="featureColumn">The features column.</param> /// <param name="weights">The weights column.</param> /// <param name="numLeaves">The number of leaves to use.</param> /// <param name="numBoostRound">Number of iterations.</param> /// <param name="minDataPerLeaf">The minimal number of documents allowed in a leaf of the tree, out of the subsampled data.</param> /// <param name="learningRate">The learning rate.</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[ScoreTensorFlowModel](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/LightGbmBinaryClassification.cs)] /// ]]> /// </format> /// </example> public static LightGbmBinaryTrainer LightGbm(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weights = null, int? numLeaves = null, int? minDataPerLeaf = null, double? learningRate = null, int numBoostRound = Options.Defaults.NumBoostRound) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return new LightGbmBinaryTrainer(env, labelColumn, featureColumn, weights, numLeaves, minDataPerLeaf, learningRate, numBoostRound); }
/// <summary> /// Predict a target using generalized additive models trained with the <see cref="BinaryClassificationGamTrainer"/>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="labelColumn">The labelColumn column.</param> /// <param name="featureColumn">The featureColumn column.</param> /// <param name="weights">The optional weights column.</param> /// <param name="numIterations">The number of iterations to use in learning the features.</param> /// <param name="learningRate">The learning rate. GAMs work best with a small learning rate.</param> /// <param name="maxBins">The maximum number of bins to use to approximate features.</param> public static BinaryClassificationGamTrainer GeneralizedAdditiveModels(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weights = null, int numIterations = GamDefaults.NumIterations, double learningRate = GamDefaults.LearningRates, int maxBins = GamDefaults.MaxBins) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new BinaryClassificationGamTrainer(env, labelColumn, featureColumn, weights, numIterations, learningRate, maxBins)); }
/// <summary> /// Predict a target using generalized additive models trained with the <see cref="BinaryClassificationGamTrainer"/>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="labelColumnName">The name of the label column.</param> /// <param name="featureColumnName">The name of the feature column.</param> /// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param> /// <param name="numberOfIterations">The number of iterations to use in learning the features.</param> /// <param name="maximumBinCountPerFeature">The maximum number of bins to use to approximate features.</param> /// <param name="learningRate">The learning rate. GAMs work best with a small learning rate.</param> public static BinaryClassificationGamTrainer GeneralizedAdditiveModels(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, int numberOfIterations = GamDefaults.NumberOfIterations, int maximumBinCountPerFeature = GamDefaults.MaximumBinCountPerFeature, double learningRate = GamDefaults.LearningRate) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new BinaryClassificationGamTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numberOfIterations, learningRate, maximumBinCountPerFeature)); }
/// <summary> /// Predict a target using a decision tree regression model trained with the <see cref="FastForestClassification"/>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="labelColumnName">The name of the label column.</param> /// <param name="featureColumnName">The name of the feature column.</param> /// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param> /// <param name="numberOfTrees">Total number of decision trees to create in the ensemble.</param> /// <param name="numberOfLeaves">The maximum number of leaves per decision tree.</param> /// <param name="minDatapointsInLeaves">The minimal number of datapoints allowed in a leaf of the tree, out of the subsampled data.</param> public static FastForestClassification FastForest(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, int numberOfLeaves = Defaults.NumberOfLeaves, int numberOfTrees = Defaults.NumberOfTrees, int minDatapointsInLeaves = Defaults.MinimumExampleCountPerLeaf) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new FastForestClassification(env, labelColumnName, featureColumnName, exampleWeightColumnName, numberOfLeaves, numberOfTrees, minDatapointsInLeaves)); }
/// <summary> /// Predict a target using a decision tree binary classification model trained with the <see cref="FastTreeBinaryClassificationTrainer"/>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="labelColumnName">The name of the label column.</param> /// <param name="featureColumnName">The name of the feature column.</param> /// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param> /// <param name="numTrees">Total number of decision trees to create in the ensemble.</param> /// <param name="numLeaves">The maximum number of leaves per decision tree.</param> /// <param name="minDatapointsInLeaves">The minimal number of datapoints allowed in a leaf of the tree, out of the subsampled data.</param> /// <param name="learningRate">The learning rate.</param> public static FastTreeBinaryClassificationTrainer FastTree(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, int numLeaves = Defaults.NumLeaves, int numTrees = Defaults.NumTrees, int minDatapointsInLeaves = Defaults.MinDocumentsInLeaves, double learningRate = Defaults.LearningRates) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new FastTreeBinaryClassificationTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numLeaves, numTrees, minDatapointsInLeaves, learningRate)); }
/// <summary> /// Predict a target using a decision tree binary classification model trained with the <see cref="LightGbmBinaryTrainer"/>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="labelColumnName">The name of the label column.</param> /// <param name="featureColumnName">The name of the feature column.</param> /// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param> /// <param name="numberOfLeaves">The number of leaves to use.</param> /// <param name="minimumExampleCountPerLeaf">The minimal number of data points allowed in a leaf of the tree, out of the subsampled data.</param> /// <param name="learningRate">The learning rate.</param> /// <param name="numberOfIterations">The number of iterations to use.</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[ScoreTensorFlowModel](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/LightGbmBinaryClassification.cs)] /// ]]> /// </format> /// </example> public static LightGbmBinaryTrainer LightGbm(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string exampleWeightColumnName = null, int?numberOfLeaves = null, int?minimumExampleCountPerLeaf = null, double?learningRate = null, int numberOfIterations = Options.Defaults.NumberOfIterations) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new LightGbmBinaryTrainer(env, labelColumnName, featureColumnName, exampleWeightColumnName, numberOfLeaves, minimumExampleCountPerLeaf, learningRate, numberOfIterations)); }
/// <summary> /// Predict a target using logistic regression trained with the <see cref="SgdBinaryTrainer"/> trainer. /// </summary> /// <param name="catalog">The binary classificaiton catalog trainer object.</param> /// <param name="labelColumnName">The name of the label column.</param> /// <param name="featureColumnName">The name of the feature column.</param> /// <param name="weightColumnName">The name for the example weight column.</param> /// <param name="maxIterations">The maximum number of iterations; set to 1 to simulate online learning.</param> /// <param name="initLearningRate">The initial learning rate used by SGD.</param> /// <param name="l2Weight">The L2 regularization constant.</param> public static SgdBinaryTrainer StochasticGradientDescent(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, string weightColumnName = null, int maxIterations = SgdBinaryTrainer.Options.Defaults.MaxIterations, double initLearningRate = SgdBinaryTrainer.Options.Defaults.InitLearningRate, float l2Weight = SgdBinaryTrainer.Options.Defaults.L2Weight) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new SgdBinaryTrainer(env, labelColumnName, featureColumnName, weightColumnName, maxIterations, initLearningRate, l2Weight)); }
/// <summary> /// Predict a target using a logistic regression model trained with the SDCA trainer. /// The trained model can produce probablity by feeding the output value of the linear /// function to a <see cref="PlattCalibrator"/>. /// </summary> /// <param name="catalog">The binary classification catalog trainer object.</param> /// <param name="labelColumn">The labelColumn, or dependent variable.</param> /// <param name="featureColumn">The features, or independent variables.</param> /// <param name="weights">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> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[SDCA](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/SDCALogisticRegression.cs)] /// ]]></format> /// </example> public static SdcaBinaryTrainer StochasticDualCoordinateAscent( this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weights = null, float?l2Const = null, float?l1Threshold = null, int?maxIterations = null) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new SdcaBinaryTrainer(env, labelColumn, featureColumn, weights, l2Const, l1Threshold, maxIterations)); }
/// <summary> /// Predict a target using a linear binary classification model trained with the <see cref="SymSgdClassificationTrainer"/>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="labelColumn">The labelColumn column.</param> /// <param name="featureColumn">The features column.</param> public static SymSgdClassificationTrainer SymbolicStochasticGradientDescent(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); var options = new SymSgdClassificationTrainer.Options { LabelColumn = labelColumn, FeatureColumn = featureColumn, }; return(new SymSgdClassificationTrainer(env, options)); }
/// <summary> /// Predict a target using a linear binary classification model trained with the <see cref="Trainers.LogisticRegression"/> trainer. /// </summary> /// <param name="catalog">The binary classificaiton catalog trainer object.</param> /// <param name="labelColumn">The label column name, or dependent variable.</param> /// <param name="featureColumn">The features, or independent variables.</param> /// <param name="weights">The optional example weights.</param> /// <param name="enforceNoNegativity">Enforce non-negative weights.</param> /// <param name="l1Weight">Weight of L1 regularization term.</param> /// <param name="l2Weight">Weight of L2 regularization term.</param> /// <param name="memorySize">Memory size for <see cref="Trainers.LogisticRegression"/>. Low=faster, less accurate.</param> /// <param name="optimizationTolerance">Threshold for optimizer convergence.</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[Logistic Regression](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/LogisticRegression.cs)] /// ]]> /// </format> /// </example> public static LogisticRegression LogisticRegression(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, string weights = null, float l1Weight = LROptions.Defaults.L1Weight, float l2Weight = LROptions.Defaults.L2Weight, float optimizationTolerance = LROptions.Defaults.OptTol, int memorySize = LROptions.Defaults.MemorySize, bool enforceNoNegativity = LROptions.Defaults.EnforceNonNegativity) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new LogisticRegression(env, labelColumn, featureColumn, weights, l1Weight, l2Weight, optimizationTolerance, memorySize, enforceNoNegativity)); }
/// <summary> /// Predict a target using a linear binary classification model trained with the <see cref="SymbolicSgdTrainer"/>. /// Stochastic gradient descent (SGD) is an iterative algorithm that optimizes a differentiable objective function. /// The <see cref="SymbolicSgdTrainer"/> parallelizes SGD using <a href="https://www.microsoft.com/en-us/research/project/project-parade/#!symbolic-execution">symbolic execution</a>. /// </summary> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <param name="labelColumnName">The name of the label column.</param> /// <param name="featureColumnName">The name of the feature column.</param> /// <param name="numberOfIterations">Number of training iterations.</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[SymbolicStochasticGradientDescent](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/SymbolicStochasticGradientDescent.cs)] /// ]]> /// </format> /// </example> public static SymbolicSgdTrainer SymbolicSgd(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumnName = DefaultColumnNames.Label, string featureColumnName = DefaultColumnNames.Features, int numberOfIterations = SymbolicSgdTrainer.Defaults.NumberOfIterations) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); var options = new SymbolicSgdTrainer.Options { LabelColumnName = labelColumnName, FeatureColumnName = featureColumnName, }; return(new SymbolicSgdTrainer(env, options)); }
/// <summary> /// Predict a target using a linear binary classification model trained with <see cref="AveragedPerceptronTrainer"/>. /// </summary> /// <param name="catalog">The binary classification catalog trainer object.</param> /// <param name="labelColumn">The name of the label column, or dependent variable.</param> /// <param name="featureColumn">The features, or independent variables.</param> /// <param name="lossFunction">A custom <a href="tmpurl_loss">loss</a>. If <see langword="null"/>, hinge loss will be used resulting in max-margin averaged perceptron.</param> /// <param name="learningRate"><a href="tmpurl_lr">Learning rate</a>.</param> /// <param name="decreaseLearningRate"> /// <see langword="true" /> to decrease the <paramref name="learningRate"/> as iterations progress; otherwise, <see langword="false" />. /// Default is <see langword="false" />. /// </param> /// <param name="l2RegularizerWeight">L2 weight for <a href='tmpurl_regularization'>regularization</a>.</param> /// <param name="numIterations">Number of passes through the training dataset.</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[AveragedPerceptron](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/AveragedPerceptron.cs)] /// ]]> /// </format> /// </example> public static AveragedPerceptronTrainer AveragedPerceptron( this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string labelColumn = DefaultColumnNames.Label, string featureColumn = DefaultColumnNames.Features, IClassificationLoss lossFunction = null, float learningRate = AveragedLinearArguments.AveragedDefaultArgs.LearningRate, bool decreaseLearningRate = AveragedLinearArguments.AveragedDefaultArgs.DecreaseLearningRate, float l2RegularizerWeight = AveragedLinearArguments.AveragedDefaultArgs.L2RegularizerWeight, int numIterations = AveragedLinearArguments.AveragedDefaultArgs.NumIterations) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new AveragedPerceptronTrainer(env, labelColumn, featureColumn, lossFunction ?? new LogLoss(), learningRate, decreaseLearningRate, l2RegularizerWeight, numIterations)); }
/// <summary> /// Predict a target using a field-aware factorization machine algorithm. /// </summary> /// <param name="catalog">The binary classification catalog trainer object.</param> /// <param name="featureColumnNames">The name(s) of the feature columns.</param> /// <param name="labelColumnName">The name of the label column.</param> /// <param name="exampleWeightColumnName">The name of the example weight column (optional).</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[FieldAwareFactorizationMachine](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/FieldAwareFactorizationMachine.cs)] /// ]]></format> /// </example> public static FieldAwareFactorizationMachineTrainer FieldAwareFactorizationMachine(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string[] featureColumnNames, string labelColumnName = DefaultColumnNames.Label, string exampleWeightColumnName = null) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new FieldAwareFactorizationMachineTrainer(env, featureColumnNames, labelColumnName, exampleWeightColumnName)); }
/// <summary> /// Predict a target using the random binary classification model <see cref="RandomTrainer"/>. /// </summary> /// <remarks> /// This trainer can be used as a baseline for other more sophisticated mdels. /// </remarks> /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param> /// <example> /// <format type="text/markdown"> /// <![CDATA[ /// [!code-csharp[FastTree](~/../docs/samples/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/RandomTrainerSample.cs)] /// ]]></format> /// </example> public static RandomTrainer Random(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog) { Contracts.CheckValue(catalog, nameof(catalog)); return(new RandomTrainer(CatalogUtils.GetEnvironment(catalog), new RandomTrainer.Options())); }
/// <summary> /// Predict a target using a field-aware factorization machine algorithm. /// </summary> /// <param name="catalog">The binary classification catalog trainer object.</param> /// <param name="options">Advanced arguments to the algorithm.</param> public static FieldAwareFactorizationMachineTrainer FieldAwareFactorizationMachine(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, FieldAwareFactorizationMachineTrainer.Options options) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new FieldAwareFactorizationMachineTrainer(env, options)); }
/// <summary> /// Predict a target using a field-aware factorization machine algorithm. /// </summary> /// <param name="catalog">The binary classification catalog trainer object.</param> /// <param name="featureColumns">The features, or independent variables.</param> /// <param name="labelColumn">The label, or dependent variable.</param> /// <param name="weights">The optional example weights.</param> /// <param name="advancedSettings">A delegate to set more settings. /// The settings here will override the ones provided in the direct method signature, /// if both are present and have different values. /// The columns names, however need to be provided directly, not through the <paramref name="advancedSettings"/>.</param> public static FieldAwareFactorizationMachineTrainer FieldAwareFactorizationMachine(this BinaryClassificationCatalog.BinaryClassificationTrainers catalog, string[] featureColumns, string labelColumn = DefaultColumnNames.Label, string weights = null, Action <FieldAwareFactorizationMachineTrainer.Arguments> advancedSettings = null) { Contracts.CheckValue(catalog, nameof(catalog)); var env = CatalogUtils.GetEnvironment(catalog); return(new FieldAwareFactorizationMachineTrainer(env, featureColumns, labelColumn, weights, advancedSettings: advancedSettings)); }