Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class Options

public Options()
{
NgramLength = 1;
NgramLength = 2;
SkipLength = NgramExtractingEstimator.Defaults.SkipLength;
UseAllLengths = NgramExtractingEstimator.Defaults.UseAllLengths;
MaximumNgramsCount = new int[] { NgramExtractingEstimator.Defaults.MaximumNgramsCount };
Expand Down
1 change: 1 addition & 0 deletions test/BaselineOutput/Common/EntryPoints/core_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -23696,6 +23696,7 @@
"Default": {
"Name": "NGram",
"Settings": {
"NgramLength": 2,
"MaxNumTerms": [
10000000
]
Expand Down
14 changes: 7 additions & 7 deletions test/BaselineOutput/Common/Text/featurized.tsv

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ CalibratorTestData GetCalibratorTestData()
var transformer = pipeline.Fit(data);
var scoredData = transformer.Transform(data);
var scoredDataPreview = scoredData.Preview();
Assert.True(scoredDataPreview.ColumnView.Length == 5);
Assert.True(scoredDataPreview.ColumnView.Length == 6);

return new CalibratorTestData
{
Expand All @@ -128,11 +128,11 @@ private void CheckValidCalibratedData(IDataView scoredData, ITransformer transfo

var calibratedData = transformer.Transform(scoredData).Preview();

Assert.True(calibratedData.ColumnView.Length == 6);
Assert.True(calibratedData.ColumnView.Length == 7);

for (int i = 0; i < 10; i++)
{
var probability = calibratedData.RowView[i].Values[5];
var probability = calibratedData.RowView[i].Values[6];
Assert.InRange((float)probability.Value, 0, 1);
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/Microsoft.ML.Tests/TrainerEstimators/LbfgsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ public void TestLRWithStats()

Assert.NotNull(biasStats);

CompareNumbersWithTolerance(biasStats.StandardError, 0.25, digitsOfPrecision: 2);
CompareNumbersWithTolerance(biasStats.ZScore, 7.97, digitsOfPrecision: 2);
CompareNumbersWithTolerance(biasStats.StandardError, 0.24, digitsOfPrecision: 2);
CompareNumbersWithTolerance(biasStats.ZScore, 8.32, digitsOfPrecision: 2);

var scoredData = transformer.Transform(dataView);

var coefficients = stats.GetWeightsCoefficientStatistics(100);

Assert.Equal(18, coefficients.Length);
Assert.Equal(17, coefficients.Length);

foreach (var coefficient in coefficients)
Assert.True(coefficient.StandardError < 1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ public void TestEstimatorLdSvmTrainer()
Columns = new[]
{
new TextLoader.Column("Label", DataKind.Boolean, 0),
new TextLoader.Column("SentimentText", DataKind.String, 1)
new TextLoader.Column("SentimentText", DataKind.String, 1),
new TextLoader.Column("LoggedIn", DataKind.Boolean, 2)
}
}).Load(GetDataPath(TestDatasets.Sentiment.trainFilename));

Expand All @@ -214,7 +215,8 @@ public void TestEstimatorLdSvmTrainer()
private (IEstimator<ITransformer>, IDataView) GetOneHotBinaryClassificationPipeline()
{
var (pipeline, data) = GetBinaryClassificationPipeline();
var oneHotPipeline = pipeline.Append(ML.Transforms.Categorical.OneHotEncoding("Features"));
var oneHotPipeline = pipeline.Append(ML.Transforms.Categorical.OneHotEncoding("LoggedIn"));
oneHotPipeline.Append(ML.Transforms.Concatenate("Features", "Features", "LoggedIn"));

return (oneHotPipeline, data);
}
Expand Down
6 changes: 3 additions & 3 deletions test/Microsoft.ML.Tests/Transformers/TextFeaturizerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ public void TextFeaturizerWithL2NormTest()
var prediction = engine.Predict(data[0]);
Assert.Equal(data[0].A, string.Join(" ", prediction.OutputTokens));
var exp1 = 0.333333343f;
var exp2 = 0.707106769f;
var expected = new float[] { exp1, exp1, exp1, exp1, exp1, exp1, exp1, exp1, exp1, exp2, exp2 };
var exp2 = 0.577350259f;
var expected = new float[] { exp1, exp1, exp1, exp1, exp1, exp1, exp1, exp1, exp1, exp2, exp2, exp2 };
Assert.Equal(expected, prediction.Features);

prediction = engine.Predict(data[1]);
exp1 = 0.4472136f;
Assert.Equal(data[1].A, string.Join(" ", prediction.OutputTokens));
expected = new float[] { exp1, 0.0f, 0.0f, 0.0f, 0.0f, exp1, exp1, exp1, exp1, 0.0f, 1.0f };
expected = new float[] { exp1, 0.0f, 0.0f, 0.0f, 0.0f, exp1, exp1, exp1, exp1, 0.0f, 0.0f, 1.0f };
Assert.Equal(expected, prediction.Features);
}

Expand Down
8 changes: 7 additions & 1 deletion test/data/wikipedia-detox-250-line-data-schema.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@
"ItemKind": "TX",
"Purpose": "TextFeature",
"ColumnRangeSelector": "1"
},
{
"SuggestedName": "LoggedIn",
"ItemKind": "Bool",
"Purpose": "Categorical",
"ColumnRangeSelector": "2"
}
]
]
Loading