Skip to content

Commit 8a3df28

Browse files
committed
general cleanup
1 parent a3b6522 commit 8a3df28

File tree

21 files changed

+110
-70
lines changed

21 files changed

+110
-70
lines changed

src/Microsoft.ML.Data/DataLoadSave/Text/TextLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ private Schema ComputeOutputSchema()
905905

906906
internal const string Summary = "Loads text data file.";
907907

908-
public const string LoaderSignature = "TextLoader";
908+
internal const string LoaderSignature = "TextLoader";
909909

910910
private const uint VerForceVectorSupported = 0x0001000A;
911911
private const uint VersionNoMinCount = 0x0001000C;

src/Microsoft.ML.Data/DataLoadSave/TransformWrapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ namespace Microsoft.ML.Data
2020
// It needs to become internal.
2121
public sealed class TransformWrapper : ITransformer
2222
{
23-
public const string LoaderSignature = "TransformWrapper";
23+
internal const string LoaderSignature = "TransformWrapper";
2424
private const string TransformDirTemplate = "Step_{0:000}";
2525

2626
private readonly IHost _host;

src/Microsoft.ML.Data/Prediction/CalibratorCatalog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ protected VersionInfo GetVersionInfo()
224224
loaderAssemblyName: typeof(CalibratorTransformer<>).Assembly.FullName);
225225
}
226226

227-
private sealed class Mapper<TCalibrator> : MapperBase
227+
private sealed class Mapper<TCalibrator> : MapperBase
228228
where TCalibrator : class, ICalibrator
229229
{
230230
private TCalibrator _calibrator;

src/Microsoft.ML.Data/Scorers/PredictionTransformer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ private protected GenericScorer GetGenericScorer()
257257
public sealed class AnomalyPredictionTransformer<TModel> : SingleFeaturePredictionTransformerBase<TModel>
258258
where TModel : class
259259
{
260-
public readonly string ThresholdColumn;
261-
public readonly float Threshold;
260+
internal readonly string ThresholdColumn;
261+
internal readonly float Threshold;
262262

263263
[BestFriend]
264264
internal AnomalyPredictionTransformer(IHostEnvironment env, TModel model, Schema inputSchema, string featureColumn,
@@ -326,8 +326,8 @@ private static VersionInfo GetVersionInfo()
326326
public sealed class BinaryPredictionTransformer<TModel> : SingleFeaturePredictionTransformerBase<TModel>
327327
where TModel : class
328328
{
329-
public readonly string ThresholdColumn;
330-
public readonly float Threshold;
329+
internal readonly string ThresholdColumn;
330+
internal readonly float Threshold;
331331

332332
[BestFriend]
333333
internal BinaryPredictionTransformer(IHostEnvironment env, TModel model, Schema inputSchema, string featureColumn,

src/Microsoft.ML.FastTree/FastTreeRegression.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace Microsoft.ML.Trainers.FastTree
3636
public sealed partial class FastTreeRegressionTrainer
3737
: BoostingFastTreeTrainerBase<FastTreeRegressionTrainer.Options, RegressionPredictionTransformer<FastTreeRegressionModelParameters>, FastTreeRegressionModelParameters>
3838
{
39-
public const string LoadNameValue = "FastTreeRegression";
39+
internal const string LoadNameValue = "FastTreeRegression";
4040
internal const string UserNameValue = "FastTree (Boosted Trees) Regression";
4141
internal const string Summary = "Trains gradient boosted decision trees to fit target values using least-squares.";
4242
internal const string ShortName = "ftr";
@@ -142,7 +142,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm(
142142
/// </summary>
143143
/// <param name="set">The dataset</param>
144144
/// <returns>The list of regression targets, or null if <paramref name="set"/> was null</returns>
145-
public static float[] GetDatasetRegressionLabels(Dataset set)
145+
internal static float[] GetDatasetRegressionLabels(Dataset set)
146146
{
147147
if (set == null)
148148
return null;

src/Microsoft.ML.FastTree/FastTreeTweedie.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ private protected override OptimizationAlgorithm ConstructOptimizationAlgorithm(
149149
/// </summary>
150150
/// <param name="set">The dataset</param>
151151
/// <returns>The list of regression targets, or null if <paramref name="set"/> was null</returns>
152-
public static float[] GetDatasetRegressionLabels(Dataset set)
152+
internal static float[] GetDatasetRegressionLabels(Dataset set)
153153
{
154154
if (set == null)
155155
return null;

src/Microsoft.ML.LightGBM/LightGbmRankingTrainer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ private static LightGbmRankingModelParameters Create(IHostEnvironment env, Model
7575
/// <include file='doc.xml' path='doc/members/member[@name="LightGBM"]/*' />
7676
public sealed class LightGbmRankingTrainer : LightGbmTrainerBase<float, RankingPredictionTransformer<LightGbmRankingModelParameters>, LightGbmRankingModelParameters>
7777
{
78-
public const string UserName = "LightGBM Ranking";
79-
public const string LoadNameValue = "LightGBMRanking";
80-
public const string ShortName = "LightGBMRank";
78+
internal const string UserName = "LightGBM Ranking";
79+
internal const string LoadNameValue = "LightGBMRanking";
80+
internal const string ShortName = "LightGBMRank";
8181

8282
public override PredictionKind PredictionKind => PredictionKind.Ranking;
8383

src/Microsoft.ML.OnnxTransform/DnnImageFeaturizerTransform.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public sealed class DnnImageFeaturizerEstimator : IEstimator<TransformerChain<Co
6161
/// For an example, see Microsoft.ML.DnnImageFeaturizer.ResNet18 </param>
6262
/// <param name="outputColumnName">Name of the column resulting from the transformation of <paramref name="inputColumnName"/>.</param>
6363
/// <param name="inputColumnName">Name of column to transform. If set to <see langword="null"/>, the value of the <paramref name="outputColumnName"/> will be used as source.</param>
64-
public DnnImageFeaturizerEstimator(IHostEnvironment env, string outputColumnName, Func<DnnImageFeaturizerInput, EstimatorChain<ColumnCopyingTransformer>> modelFactory, string inputColumnName = null)
64+
internal DnnImageFeaturizerEstimator(IHostEnvironment env, string outputColumnName, Func<DnnImageFeaturizerInput, EstimatorChain<ColumnCopyingTransformer>> modelFactory, string inputColumnName = null)
6565
{
6666
_modelChain = modelFactory(new DnnImageFeaturizerInput(outputColumnName, inputColumnName ?? outputColumnName, env, new DnnImageModelSelector()));
6767
}

src/Microsoft.ML.OnnxTransform/OnnxCatalog.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
using System;
56
using Microsoft.ML.Data;
67
using Microsoft.ML.Transforms;
78

@@ -61,5 +62,19 @@ public static OnnxScoringEstimator ApplyOnnxModel(this TransformsCatalog catalog
6162
bool fallbackToCpu = false)
6263
=> new OnnxScoringEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnNames, inputColumnNames, modelFile, gpuDeviceId, fallbackToCpu);
6364

65+
/// <summary>
66+
/// Applies a pre-trained DNN model to featurize an image.
67+
/// </summary>
68+
/// <param name="catalog">The transform's catalog.</param>
69+
/// <param name="outputColumnName">The name of the column resulting from the transformation of <paramref name="inputColumnName"/>.</param>
70+
/// <param name="modelFactory">An extension method on the <see cref="DnnImageModelSelector"/> that creates a chain of two
71+
/// <see cref="OnnxScoringEstimator"/> (one for preprocessing and one with a pretrained image DNN) with specific models
72+
/// included in a package together with that extension method.</param>
73+
/// <param name="inputColumnName">Name of column to transform. If set to <see langword="null"/>, the value of the <paramref name="outputColumnName"/> will be used as source.</param>
74+
public static DnnImageFeaturizerEstimator DnnFeaturizeImage(this TransformsCatalog catalog,
75+
string outputColumnName,
76+
Func<DnnImageFeaturizerInput, EstimatorChain<ColumnCopyingTransformer>> modelFactory,
77+
string inputColumnName = null)
78+
=> new DnnImageFeaturizerEstimator(CatalogUtils.GetEnvironment(catalog), outputColumnName, modelFactory, inputColumnName);
6479
}
6580
}

src/Microsoft.ML.StandardLearners/FactorizationMachine/FieldAwareFactorizationMachineModelParameters.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,17 +285,17 @@ public float[] GetLatentWeights()
285285

286286
public sealed class FieldAwareFactorizationMachinePredictionTransformer : PredictionTransformerBase<FieldAwareFactorizationMachineModelParameters>
287287
{
288-
public const string LoaderSignature = "FAFMPredXfer";
288+
internal const string LoaderSignature = "FAFMPredXfer";
289289

290290
/// <summary>
291291
/// The name of the feature column used by the prediction transformer.
292292
/// </summary>
293-
public IReadOnlyList<string> FeatureColumns { get; }
293+
internal IReadOnlyList<string> FeatureColumns { get; }
294294

295295
/// <summary>
296296
/// The type of the feature columns.
297297
/// </summary>
298-
public IReadOnlyList<ColumnType> FeatureColumnTypes { get; }
298+
internal IReadOnlyList<ColumnType> FeatureColumnTypes { get; }
299299

300300
private readonly string _thresholdColumn;
301301
private readonly float _threshold;

0 commit comments

Comments
 (0)