Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding extensions for Hal learners. More namespace re-ogr. #1370

Merged
merged 9 commits into from
Oct 25, 2018
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using Microsoft.ML.Runtime.Ensemble.Selector;
using Microsoft.ML.Runtime.EntryPoints;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.Learners;
using Microsoft.ML.Trainers.Online;

[assembly: LoadableClass(EnsembleTrainer.Summary, typeof(EnsembleTrainer), typeof(EnsembleTrainer.Arguments),
new[] { typeof(SignatureBinaryClassifierTrainer), typeof(SignatureTrainer) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using Microsoft.ML.Runtime.Ensemble.OutputCombiners;
using Microsoft.ML.Runtime.Ensemble.Selector;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.Learners;
using Microsoft.ML.Trainers.Online;

[assembly: LoadableClass(typeof(RegressionEnsembleTrainer), typeof(RegressionEnsembleTrainer.Arguments),
new[] { typeof(SignatureRegressorTrainer), typeof(SignatureTrainer) },
Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.ML.FastTree/FastTreeCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static class FastTreeRegressionExtensions
/// </summary>
/// <param name="ctx">The <see cref="RegressionContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features colum.</param>
/// <param name="features">The features 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>
Expand Down Expand Up @@ -50,7 +50,7 @@ public static class FastTreeBinaryClassificationExtensions
/// </summary>
/// <param name="ctx">The <see cref="BinaryClassificationContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features colum.</param>
/// <param name="features">The features 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>
Expand Down Expand Up @@ -81,7 +81,7 @@ public static class FastTreeRankingExtensions
/// </summary>
/// <param name="ctx">The <see cref="RegressionContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features colum.</param>
/// <param name="features">The features column.</param>
/// <param name="groupId">The groupId column.</param>
/// <param name="weights">The optional weights column.</param>
/// <param name="advancedSettings">Algorithm advanced settings.</param>
Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.ML.FastTree/FastTreeStatic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static class FastTreeRegressionExtensions
/// </summary>
/// <param name="ctx">The <see cref="RegressionContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features colum.</param>
/// <param name="features">The features 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>
Expand Down Expand Up @@ -75,7 +75,7 @@ public static class FastTreeBinaryClassificationExtensions
/// </summary>
/// <param name="ctx">The <see cref="BinaryClassificationContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features colum.</param>
/// <param name="features">The features 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>
Expand Down Expand Up @@ -125,7 +125,7 @@ public static class FastTreeRankingExtensions
/// </summary>
/// <param name="ctx">The <see cref="RegressionContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features colum.</param>
/// <param name="features">The features column.</param>
/// <param name="groupId">The groupId column.</param>
/// <param name="weights">The optional weights column.</param>
/// <param name="numTrees">Total number of decision trees to create in the ensemble.</param>
Expand Down
54 changes: 54 additions & 0 deletions src/Microsoft.ML.HalLearners/HalLearnersCatalog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.ML.Runtime;
using Microsoft.ML.Runtime.Data;
using Microsoft.ML.Trainers.HalLearners;
using Microsoft.ML.Trainers.SymSgd;
using System;

namespace Microsoft.ML
{
/// <summary>
/// The trainer context extensions for the <see cref="OlsLinearRegressionTrainer"/> and <see cref="SymSgdClassificationTrainer"/>.
/// </summary>
public static class HalLearnersCatalog
{
/// <summary>
/// Predict a target using a linear regression model trained with the <see cref="OlsLinearRegressionTrainer"/>.
/// </summary>
/// <param name="ctx">The <see cref="RegressionContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features column.</param>
/// <param name="weights">The weights column.</param>
/// <param name="advancedSettings">Algorithm advanced settings.</param>
public static OlsLinearRegressionTrainer OrdinaryLeastSquares(this RegressionContext.RegressionTrainers ctx,
string label,
string features,
string weights = null,
Action<OlsLinearRegressionTrainer.Arguments> advancedSettings = null)
{
Contracts.CheckValue(ctx, nameof(ctx));
var env = CatalogUtils.GetEnvironment(ctx);
return new OlsLinearRegressionTrainer(env, label, features, weights, advancedSettings);
}

/// <summary>
/// Predict a target using a linear regression model trained with the <see cref="SymSgdClassificationTrainer"/>.
/// </summary>
/// <param name="ctx">The <see cref="RegressionContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features column.</param>
/// <param name="advancedSettings">Algorithm advanced settings.</param>
public static SymSgdClassificationTrainer SymbolicStochasticGradientDescent(this RegressionContext.RegressionTrainers ctx,
string label,
string features,
Action<SymSgdClassificationTrainer.Arguments> advancedSettings = null)
{
Contracts.CheckValue(ctx, nameof(ctx));
var env = CatalogUtils.GetEnvironment(ctx);
return new SymSgdClassificationTrainer(env, label, features, advancedSettings);
}
}
}
4 changes: 2 additions & 2 deletions src/Microsoft.ML.HalLearners/OlsLinearRegression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.IO;
using Microsoft.ML.Core.Data;
using Microsoft.ML.Runtime;
using Microsoft.ML.Runtime.HalLearners;
using Microsoft.ML.Trainers.HalLearners;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.Internal.Utilities;
using Microsoft.ML.Runtime.CommandLine;
Expand All @@ -30,7 +30,7 @@

[assembly: LoadableClass(typeof(void), typeof(OlsLinearRegressionTrainer), null, typeof(SignatureEntryPointModule), OlsLinearRegressionTrainer.LoadNameValue)]

namespace Microsoft.ML.Runtime.HalLearners
namespace Microsoft.ML.Trainers.HalLearners
{
/// <include file='doc.xml' path='doc/members/member[@name="OLS"]/*' />
public sealed class OlsLinearRegressionTrainer : TrainerEstimatorBase<RegressionPredictionTransformer<OlsLinearRegressionPredictor>, OlsLinearRegressionPredictor>
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ML.HalLearners/SymSgdClassificationTrainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.Internal.Utilities;
using Microsoft.ML.Runtime.Learners;
using Microsoft.ML.Runtime.SymSgd;
using Microsoft.ML.Trainers.SymSgd;
using Microsoft.ML.Runtime.Training;

[assembly: LoadableClass(typeof(SymSgdClassificationTrainer), typeof(SymSgdClassificationTrainer.Arguments),
Expand All @@ -27,7 +27,7 @@

[assembly: LoadableClass(typeof(void), typeof(SymSgdClassificationTrainer), null, typeof(SignatureEntryPointModule), SymSgdClassificationTrainer.LoadNameValue)]

namespace Microsoft.ML.Runtime.SymSgd
namespace Microsoft.ML.Trainers.SymSgd
{
using TPredictor = IPredictorWithFeatureWeights<float>;

Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.KMeansClustering/KMeansCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using Microsoft.ML.Runtime;
using Microsoft.ML.Runtime.Data;
using Microsoft.ML.Runtime.KMeans;
using Microsoft.ML.Trainers.KMeans;
using System;

namespace Microsoft.ML
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ML.KMeansClustering/KMeansPlusPlusTrainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Microsoft.ML.Runtime.Internal.CpuMath;
using Microsoft.ML.Runtime.Internal.Internallearn;
using Microsoft.ML.Runtime.Internal.Utilities;
using Microsoft.ML.Runtime.KMeans;
using Microsoft.ML.Trainers.KMeans;
using Microsoft.ML.Runtime.Numeric;
using Microsoft.ML.Runtime.Training;
using System;
Expand All @@ -25,7 +25,7 @@

[assembly: LoadableClass(typeof(void), typeof(KMeansPlusPlusTrainer), null, typeof(SignatureEntryPointModule), "KMeans")]

namespace Microsoft.ML.Runtime.KMeans
namespace Microsoft.ML.Trainers.KMeans
{
/// <include file='./doc.xml' path='doc/members/member[@name="KMeans++"]/*' />
public class KMeansPlusPlusTrainer : TrainerEstimatorBase<ClusteringPredictionTransformer<KMeansPredictor>, KMeansPredictor>
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ML.KMeansClustering/KMeansPredictor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Microsoft.ML.Runtime.Internal.Utilities;
using Microsoft.ML.Runtime;
using Microsoft.ML.Runtime.Data;
using Microsoft.ML.Runtime.KMeans;
using Microsoft.ML.Trainers.KMeans;
using Microsoft.ML.Runtime.Model;
using Microsoft.ML.Runtime.Model.Onnx;
using Microsoft.ML.Runtime.Internal.Internallearn;
Expand All @@ -19,7 +19,7 @@
[assembly: LoadableClass(typeof(KMeansPredictor), null, typeof(SignatureLoadModel),
"KMeans predictor", KMeansPredictor.LoaderSignature)]

namespace Microsoft.ML.Runtime.KMeans
namespace Microsoft.ML.Trainers.KMeans
{
public sealed class KMeansPredictor :
PredictorBase<VBuffer<Float>>,
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.KMeansClustering/KMeansStatic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using Microsoft.ML.Runtime;
using Microsoft.ML.Runtime.Data;
using Microsoft.ML.Runtime.KMeans;
using Microsoft.ML.Trainers.KMeans;
using Microsoft.ML.StaticPipe.Runtime;
using System;

Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ML.Legacy/AssemblyRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
using Microsoft.ML.Runtime.Api;
using Microsoft.ML.Runtime.Data;
using Microsoft.ML.Trainers.FastTree;
using Microsoft.ML.Runtime.KMeans;
using Microsoft.ML.Runtime.PCA;
using Microsoft.ML.Trainers.KMeans;
using Microsoft.ML.Trainers.PCA;
using Microsoft.ML.Runtime.Sweeper;
using Microsoft.ML.Runtime.Tools;
using System;
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ML.LightGBM/LightGbmCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static class LightGbmRegressionExtensions
/// </summary>
/// <param name="ctx">The <see cref="RegressionContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features colum.</param>
/// <param name="features">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>
Expand Down Expand Up @@ -53,7 +53,7 @@ public static class LightGbmClassificationExtensions
/// </summary>
/// <param name="ctx">The <see cref="BinaryClassificationContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features colum.</param>
/// <param name="features">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>
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ML.LightGBM/LightGbmStatic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static partial class RegressionTrainers
/// </summary>
/// <param name="ctx">The <see cref="RegressionContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features colum.</param>
/// <param name="features">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>
Expand Down Expand Up @@ -75,7 +75,7 @@ public static partial class ClassificationTrainers {
/// </summary>
/// <param name="ctx">The <see cref="BinaryClassificationContext"/>.</param>
/// <param name="label">The label column.</param>
/// <param name="features">The features colum.</param>
/// <param name="features">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>
Expand Down
Loading