Skip to content

Commit f7b0a95

Browse files
authored
Fix readme sample (#2930)
1 parent fc03353 commit f7b0a95

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,18 @@ For more information, see the [.NET Foundation Code of Conduct](https://dotnetfo
6565

6666
## Examples
6767

68-
Here's an example of code to train a model to predict sentiment from text samples.
68+
Here is a snippet code for training a model to predict sentiment from text samples. You can find complete samples in [samples repo](https://github.com/dotnet/machinelearning-samples).
6969

7070
```C#
71-
// Path to your training tsv file. You can use machinelearning/test/data/wikipedia-detox-250-line-data.tsv
72-
var dataPath = "wikipedia-detox-250-line-data.tsv";
71+
var dataPath = "sentiment.csv";
7372
var mlContext = new MLContext();
74-
var loader = mlContext.Data.CreateTextLoader(new TextLoader.Options
75-
{
76-
Columns = new[] {
73+
var loader = mlContext.Data.CreateTextLoader(new[]
74+
{
7775
new TextLoader.Column("SentimentText", DataKind.String, 1),
7876
new TextLoader.Column("Label", DataKind.Boolean, 0),
7977
},
80-
HasHeader = true,
81-
Separators = new[] { ',' }
82-
});
78+
hasHeader: true,
79+
separatorChar: ',');
8380
var data = loader.Load(dataPath);
8481
var learningPipeline = mlContext.Transforms.Text.FeaturizeText("Features", "SentimentText")
8582
.Append(mlContext.BinaryClassification.Trainers.FastTree());

0 commit comments

Comments
 (0)