Skip to content

Commit 88a14c4

Browse files
committed
Addressed reviewers' comments.
1 parent 06977ed commit 88a14c4

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/BinaryClassification/PriorTrainerSample.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static void Example()
2323

2424
// Step 1: Read the data as an IDataView.
2525
// First, we define the reader: specify the data columns and where to find them in the text file.
26-
var reader = mlContext.Data.CreateTextLoader(
26+
var loader = mlContext.Data.CreateTextLoader(
2727
columns: new[]
2828
{
2929
new TextLoader.Column("Sentiment", DataKind.Single, 0),
@@ -32,22 +32,22 @@ public static void Example()
3232
hasHeader: true
3333
);
3434

35-
// Read the data
36-
var trainData = reader.Load(trainFile);
35+
// Load the data
36+
var trainData = loader.Load(trainFile);
3737

3838
// Step 2: Pipeline
3939
// Featurize the text column through the FeaturizeText API.
4040
// Then append a binary classifier, setting the "Label" column as the label of the dataset, and
4141
// the "Features" column produced by FeaturizeText as the features column.
4242
var pipeline = mlContext.Transforms.Text.FeaturizeText("Features", "SentimentText")
43-
.AppendCacheCheckpoint(mlContext)
43+
.AppendCacheCheckpoint(mlContext) // Add a data-cache step within a pipeline.
4444
.Append(mlContext.BinaryClassification.Trainers.Prior(labelColumnName: "Sentiment"));
4545

4646
// Step 3: Train the pipeline
4747
var trainedPipeline = pipeline.Fit(trainData);
4848

4949
// Step 4: Evaluate on the test set
50-
var transformedData = trainedPipeline.Transform(reader.Load(testFile));
50+
var transformedData = trainedPipeline.Transform(loader.Load(testFile));
5151
var evalMetrics = mlContext.BinaryClassification.Evaluate(transformedData, label: "Sentiment");
5252
SamplesUtils.ConsoleUtils.PrintMetrics(evalMetrics);
5353

src/Microsoft.ML.SamplesUtils/SamplesDatasetUtils.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public static IDataView[] LoadFeaturizedSentimentDataset(MLContext mlContext)
100100
// Download the files
101101
var dataFiles = DownloadSentimentDataset();
102102

103-
// Define the columns to read
103+
// Define the columns to load
104104
var reader = mlContext.Data.CreateTextLoader(
105105
columns: new[]
106106
{

0 commit comments

Comments
 (0)