Skip to content

Commit f804418

Browse files
Updated 0.9 (#10222)
* Updated to 0.9 * Updated Date * Updated to 0.9
1 parent ecc8241 commit f804418

File tree

3 files changed

+33
-37
lines changed

3 files changed

+33
-37
lines changed

docs/machine-learning/how-to-guides/load-data-from-mult-column-csv-ml-net.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Load data with many columns from a CSV file for machine learning processing - ML.NET
33
description: Learn how to load data data with many columns from a CSV file for use in machine learning model building, training, and scoring with ML.NET
4-
ms.date: 01/28/2019
4+
ms.date: 01/29/2019
55
ms.custom: mvc,how-to
66
#Customer intent: As a developer, I want to load data with large numbers of columns from a CSV file so that I can use it in machine learning model building, training, and scoring with ML.NET.
77
---
@@ -14,10 +14,10 @@ When the input file contains many columns of the same type and always used toget
1414
[Example file](https://github.com/dotnet/machinelearning/tree/master/test/data/generated_regression_dataset.csv):
1515

1616
```console
17-
-2.75,0.77,-0.61,0.14,1.39,0.38,-0.53,-0.50,-2.13,-0.39,0.46,140.66
18-
-0.61,-0.37,-0.12,0.55,-1.00,0.84,-0.02,1.30,-0.24,-0.50,-2.12,148.12
19-
-0.85,-0.91,1.81,0.02,-0.78,-1.41,-1.09,-0.65,0.90,-0.37,-0.22,402.20
20-
0.28,1.05,-0.24,0.30,-0.99,0.19,0.32,-0.95,-1.19,-0.63,0.75,443.51
17+
-2.75;0.77;-0.61;0.14;1.39;0.38;-0.53;-0.50;-2.13;-0.39;0.46;140.66
18+
-0.61;-0.37;-0.12;0.55;-1.00;0.84;-0.02;1.30;-0.24;-0.50;-2.12;148.12
19+
-0.85;-0.91;1.81;0.02;-0.78;-1.41;-1.09;-0.65;0.90;-0.37;-0.22;402.20
20+
0.28;1.05;-0.24;0.30;-0.99;0.19;0.32;-0.95;-1.19;-0.63;0.75;443.51
2121
```
2222

2323
Reading this file using `TextLoader`:
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Load data from multiple files for machine learning processing - ML.NET
33
description: Learn how to Load data from multiple files for use in machine learning model building, training, and scoring with ML.NET
4-
ms.date: 11/07/2018
4+
ms.date: 01/29/2019
55
ms.custom: mvc,how-to
66
#Customer intent: As a developer, I want to load data from multiple files so that I can use it in machine learning model building, training, and scoring with ML.NET.
77
---
@@ -18,19 +18,19 @@ Use the `TextLoader`, and specify an array of files to the `Read` method. The fi
1818
var mlContext = new MLContext();
1919

2020
// Create the reader: define the data columns and where to find them in the text file.
21-
var reader = mlContext.Data.TextReader(new TextLoader.Arguments
22-
{
23-
Column = new[] {
24-
// A boolean column depicting the 'label'.
25-
new TextLoader.Column("IsOver50k", DataKind.BL, 0),
21+
var reader = mlContext.Data.CreateTextReader(
22+
columns: new TextLoader.Column[]
23+
{
24+
// A boolean column depicting the 'target label'.
25+
new TextLoader.Column("IsOver50k",DataKind.BL,0),
2626
// Three text columns.
27-
new TextLoader.Column("Workclass", DataKind.TX, 1),
28-
new TextLoader.Column("Education", DataKind.TX, 2),
29-
new TextLoader.Column("MaritalStatus", DataKind.TX, 3)
27+
new TextLoader.Column("WorkClass",DataKind.TX,1),
28+
new TextLoader.Column("Education",DataKind.TX,2),
29+
new TextLoader.Column("MaritalStatus",DataKind.TX,3)
3030
},
31-
// First line of the file is a header, not a data row.
32-
HasHeader = true
33-
});
31+
hasHeader: true
32+
);
3433

34+
// Now read the files (remember though, readers are lazy, so the actual reading will happen when the data is accessed).
3535
var data = reader.Read(exampleFile1, exampleFile2);
3636
```
Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Load data from a text file for machine learning processing - ML.NET
33
description: Discover how to load data from a text file for use in machine learning model building, training, and scoring with ML.NET
4-
ms.date: 11/07/2018
4+
ms.date: 01/29/2019
55
ms.custom: mvc,how-to
66
#Customer intent: As a developer, I want to load data from a text file so that I can use it in machine learning model building, training, and scoring with ML.NET.
77
---
@@ -13,7 +13,8 @@ ms.custom: mvc,how-to
1313
Note that it's perfectly acceptable to read some columns of a file, or read the same column multiple times.
1414

1515
[Example file](https://github.com/dotnet/machinelearning/blob/master/test/data/adult.tiny.with-schema.txt):
16-
```
16+
17+
```console
1718
Label Workclass education marital-status
1819
0 Private 11th Never-married
1920
0 Private HS-grad Married-civ-spouse
@@ -27,26 +28,21 @@ To load the data from a text file:
2728
// Create a new context for ML.NET operations. It can be used for exception tracking and logging,
2829
// as a catalog of available operations and as the source of randomness.
2930
var mlContext = new MLContext();
30-
TextLoader textLoader;
3131

3232
// Create the reader: define the data columns and where to find them in the text file.
33-
textLoader = mlContext.Data.TextReader(new TextLoader.Arguments()
34-
{
35-
Separator = ",",
36-
HasHeader = true,
37-
Column = new[]
38-
{
39-
new TextLoader.Column("VendorId", DataKind.Text, 0),
40-
new TextLoader.Column("RateCode", DataKind.Text, 1),
41-
new TextLoader.Column("PassengerCount", DataKind.R4, 2),
42-
new TextLoader.Column("TripTime", DataKind.R4, 3),
43-
new TextLoader.Column("TripDistance", DataKind.R4, 4),
44-
new TextLoader.Column("PaymentType", DataKind.Text, 5),
45-
new TextLoader.Column("FareAmount", DataKind.R4, 6)
46-
}
47-
}
33+
var reader = mlContext.Data.CreateTextReader(
34+
columns: new TextLoader.Column[]
35+
{
36+
// A boolean column depicting the 'target label'.
37+
new TextLoader.Column("IsOver50k",DataKind.BL,0),
38+
// Three text columns.
39+
new TextLoader.Column("WorkClass",DataKind.TX,1),
40+
new TextLoader.Column("Education",DataKind.TX,2),
41+
new TextLoader.Column("MaritalStatus",DataKind.TX,3)
42+
},
43+
hasHeader: true
4844
);
4945

50-
// Now read the file (remember though, readers are lazy, so the reading will happen when the data is accessed).
51-
var data = textLoader.Read(dataPath);
46+
// Now read the file (remember though, readers are lazy, so the actual reading will happen when the data is accessed).
47+
var data = reader.Read(dataPath);
5248
```

0 commit comments

Comments
 (0)