Skip to content

Commit 5286633

Browse files
committed
merge and more internalization.
1 parent 20b758a commit 5286633

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/Microsoft.ML.StandardLearners/Standard/ModelStatistics.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public readonly struct CoefficientStatistics
3333
public readonly float ZScore;
3434
public readonly float PValue;
3535

36-
public CoefficientStatistics(string name, float estimate, float stdError, float zScore, float pValue)
36+
internal CoefficientStatistics(string name, float estimate, float stdError, float zScore, float pValue)
3737
{
3838
Contracts.AssertNonEmpty(name);
3939
Name = name;

src/Microsoft.ML.StandardLearners/Standard/SdcaBinary.cs

+15-15
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ internal override void Check(IHostEnvironment env)
14401440
/// <param name="l2Const">The L2 regularization hyperparameter.</param>
14411441
/// <param name="l1Threshold">The L1 regularization hyperparameter. Higher values will tend to lead to more sparse model.</param>
14421442
/// <param name="maxIterations">The maximum number of passes to perform over the data.</param>
1443-
protected SdcaBinaryTrainerBase(IHostEnvironment env,
1443+
private protected SdcaBinaryTrainerBase(IHostEnvironment env,
14441444
string labelColumnName = DefaultColumnNames.Label,
14451445
string featureColumnName = DefaultColumnNames.Features,
14461446
string weightColumnName = null,
@@ -1460,7 +1460,7 @@ protected SdcaBinaryTrainerBase(IHostEnvironment env,
14601460
_outputColumns = ComputeSdcaBinaryClassifierSchemaShape();
14611461
}
14621462

1463-
protected SdcaBinaryTrainerBase(IHostEnvironment env, BinaryArgumentBase options, ISupportSdcaClassificationLoss loss = null, bool doCalibration = false)
1463+
private protected SdcaBinaryTrainerBase(IHostEnvironment env, BinaryArgumentBase options, ISupportSdcaClassificationLoss loss = null, bool doCalibration = false)
14641464
: base(env, options, TrainerUtils.MakeBoolScalarLabel(options.LabelColumn))
14651465
{
14661466
_loss = loss ?? new LogLossFactory().CreateComponent(env);
@@ -1470,7 +1470,7 @@ protected SdcaBinaryTrainerBase(IHostEnvironment env, BinaryArgumentBase options
14701470
_outputColumns = ComputeSdcaBinaryClassifierSchemaShape();
14711471
}
14721472

1473-
protected abstract SchemaShape.Column[] ComputeSdcaBinaryClassifierSchemaShape();
1473+
private protected abstract SchemaShape.Column[] ComputeSdcaBinaryClassifierSchemaShape();
14741474

14751475
protected override void CheckLabelCompatible(SchemaShape.Column labelCol)
14761476
{
@@ -1486,7 +1486,7 @@ protected override void CheckLabelCompatible(SchemaShape.Column labelCol)
14861486
error();
14871487
}
14881488

1489-
protected LinearBinaryModelParameters CreateLinearBinaryModelParameters(VBuffer<float>[] weights, float[] bias)
1489+
private protected LinearBinaryModelParameters CreateLinearBinaryModelParameters(VBuffer<float>[] weights, float[] bias)
14901490
{
14911491
Host.CheckParam(Utils.Size(weights) == 1, nameof(weights));
14921492
Host.CheckParam(Utils.Size(bias) == 1, nameof(bias));
@@ -1541,14 +1541,14 @@ internal SdcaBinaryTrainer(IHostEnvironment env, Options options)
15411541
{
15421542
}
15431543

1544-
protected override CalibratedModelParametersBase<LinearBinaryModelParameters, PlattCalibrator> CreatePredictor(VBuffer<float>[] weights, float[] bias)
1544+
private protected override CalibratedModelParametersBase<LinearBinaryModelParameters, PlattCalibrator> CreatePredictor(VBuffer<float>[] weights, float[] bias)
15451545
{
15461546
var linearModel = CreateLinearBinaryModelParameters(weights, bias);
15471547
var calibrator = new PlattCalibrator(Host, -1, 0);
15481548
return new ParameterMixingCalibratedModelParameters<LinearBinaryModelParameters, PlattCalibrator>(Host, linearModel, calibrator);
15491549
}
15501550

1551-
protected override SchemaShape.Column[] ComputeSdcaBinaryClassifierSchemaShape()
1551+
private protected override SchemaShape.Column[] ComputeSdcaBinaryClassifierSchemaShape()
15521552
{
15531553
return new SchemaShape.Column[]
15541554
{
@@ -1603,7 +1603,7 @@ internal SdcaNonCalibratedBinaryTrainer(IHostEnvironment env, Options options)
16031603
{
16041604
}
16051605

1606-
protected override SchemaShape.Column[] ComputeSdcaBinaryClassifierSchemaShape()
1606+
private protected override SchemaShape.Column[] ComputeSdcaBinaryClassifierSchemaShape()
16071607
{
16081608
return new SchemaShape.Column[]
16091609
{
@@ -1628,7 +1628,7 @@ protected override SchemaShape.Column[] ComputeSdcaBinaryClassifierSchemaShape()
16281628
/// <see cref="CreatePredictor"/> directly outputs a <see cref="LinearBinaryModelParameters"/> built from
16291629
/// the learned weights and bias without calibration.
16301630
/// </summary>
1631-
protected override LinearBinaryModelParameters CreatePredictor(VBuffer<float>[] weights, float[] bias)
1631+
private protected override LinearBinaryModelParameters CreatePredictor(VBuffer<float>[] weights, float[] bias)
16321632
=> CreateLinearBinaryModelParameters(weights, bias);
16331633
}
16341634

@@ -1661,7 +1661,7 @@ internal LegacySdcaBinaryTrainer(IHostEnvironment env, Options options)
16611661
{
16621662
}
16631663

1664-
protected override SchemaShape.Column[] ComputeSdcaBinaryClassifierSchemaShape()
1664+
private protected override SchemaShape.Column[] ComputeSdcaBinaryClassifierSchemaShape()
16651665
{
16661666
var outCols = new List<SchemaShape.Column>()
16671667
{
@@ -1786,7 +1786,7 @@ internal static class Defaults
17861786

17871787
private readonly OptionsBase _options;
17881788

1789-
protected IClassificationLoss Loss { get; }
1789+
private protected IClassificationLoss Loss { get; }
17901790

17911791
private protected override bool ShuffleData => _options.Shuffle;
17921792

@@ -2053,12 +2053,12 @@ private protected override TModel TrainCore(IChannel ch, RoleMappedData data, Li
20532053
/// <param name="weights">Weights of linear model.</param>
20542054
/// <param name="bias">Bias of linear model.</param>
20552055
/// <returns>A model built upon weights and bias. It can be as simple as a <see cref="LinearBinaryModelParameters"/>.</returns>
2056-
protected abstract TModel CreateModel(VBuffer<float> weights, float bias);
2056+
private protected abstract TModel CreateModel(VBuffer<float> weights, float bias);
20572057

20582058
/// <summary>
20592059
/// A helper function used to create <see cref="LinearBinaryModelParameters"/> in implementations of <see cref="CreateModel(VBuffer{float}, float)"/>.
20602060
/// </summary>
2061-
protected LinearBinaryModelParameters CreateLinearBinaryModelParameters(VBuffer<float> weights, float bias)
2061+
private protected LinearBinaryModelParameters CreateLinearBinaryModelParameters(VBuffer<float> weights, float bias)
20622062
{
20632063
Host.CheckParam(weights.Length > 0, nameof(weights));
20642064

@@ -2127,7 +2127,7 @@ protected override SchemaShape.Column[] GetOutputColumnsCore(SchemaShape inputSc
21272127
/// Given weights and bias trained in <see cref="SgdBinaryTrainerBase{TModelParameters}.TrainCore(IChannel, RoleMappedData, LinearModelParameters, int)"/>,
21282128
/// <see cref="CreateModel(VBuffer{float}, float)"/> produces the final calibrated linear model.
21292129
/// </summary>
2130-
protected override CalibratedModelParametersBase<LinearBinaryModelParameters, PlattCalibrator> CreateModel(VBuffer<float> weights, float bias)
2130+
private protected override CalibratedModelParametersBase<LinearBinaryModelParameters, PlattCalibrator> CreateModel(VBuffer<float> weights, float bias)
21312131
{
21322132
// SubModel, which is a linear function.
21332133
var subModel = CreateLinearBinaryModelParameters(weights, bias);
@@ -2182,7 +2182,7 @@ protected override SchemaShape.Column[] GetOutputColumnsCore(SchemaShape inputSc
21822182
};
21832183
}
21842184

2185-
protected override LinearBinaryModelParameters CreateModel(VBuffer<float> weights, float bias)
2185+
private protected override LinearBinaryModelParameters CreateModel(VBuffer<float> weights, float bias)
21862186
=> CreateLinearBinaryModelParameters(weights, bias);
21872187
}
21882188

@@ -2237,7 +2237,7 @@ protected override SchemaShape.Column[] GetOutputColumnsCore(SchemaShape inputSc
22372237
};
22382238
}
22392239

2240-
protected override IPredictorWithFeatureWeights<float> CreateModel(VBuffer<float> weights, float bias)
2240+
private protected override IPredictorWithFeatureWeights<float> CreateModel(VBuffer<float> weights, float bias)
22412241
{
22422242
if (!(Loss is LogLoss))
22432243
return CreateLinearBinaryModelParameters(weights, bias);

0 commit comments

Comments
 (0)