Skip to content

Commit 5db4b73

Browse files
daholsteDmitry-A
authored andcommitted
migrate to private ML.NET nuget for latest bug fixes (dotnet#131)
1 parent eed4ca3 commit 5db4b73

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+199
-233
lines changed

NuGet.Config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<configuration>
33
<packageSources>
44
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
5+
<add key="DotNetMyGet" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" protocolVersion="3" />
56
</packageSources>
67
</configuration>

src/Microsoft.ML.Auto/API/BinaryClassificationExperiment.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Collections.Generic;
77
using System.Linq;
88
using Microsoft.Data.DataView;
9-
using Microsoft.ML.Core.Data;
109
using Microsoft.ML.Data;
1110

1211
namespace Microsoft.ML.Auto

src/Microsoft.ML.Auto/API/MulticlassClassificationExperiment.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Collections.Generic;
77
using System.Linq;
88
using Microsoft.Data.DataView;
9-
using Microsoft.ML.Core.Data;
109
using Microsoft.ML.Data;
1110

1211
namespace Microsoft.ML.Auto

src/Microsoft.ML.Auto/API/Pipeline.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System.Collections.Generic;
6-
using Microsoft.ML.Core.Data;
76

87
namespace Microsoft.ML.Auto
98
{

src/Microsoft.ML.Auto/API/RegressionExperiment.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Collections.Generic;
77
using System.Linq;
88
using Microsoft.Data.DataView;
9-
using Microsoft.ML.Core.Data;
109
using Microsoft.ML.Data;
1110

1211
namespace Microsoft.ML.Auto

src/Microsoft.ML.Auto/API/RunResult.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
using System;
66
using System.Linq;
7-
using Microsoft.ML.Core.Data;
87

98
namespace Microsoft.ML.Auto
109
{

src/Microsoft.ML.Auto/AutoMlUtils.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ public static void Assert(bool boolVal, string message = null)
2323
}
2424
}
2525

26-
public static IDataView Take(this IDataView data, MLContext context, int count)
27-
{
28-
return TakeFilter.Create(context, data, count);
29-
}
30-
3126
public static IDataView DropLastColumn(this IDataView data, MLContext context)
3227
{
3328
return context.Transforms.DropColumns(data.Schema[data.Schema.Count - 1].Name).Fit(data).Transform(data);
@@ -37,23 +32,20 @@ public static (IDataView testData, IDataView validationData) TestValidateSplit(t
3732
MLContext context, IDataView trainData)
3833
{
3934
IDataView validationData;
40-
(trainData, validationData) = catalog.TrainTestSplit(trainData);
35+
var splitData = catalog.TrainTestSplit(trainData);
36+
trainData = splitData.TrainSet;
37+
validationData = splitData.TestSet;
4138
trainData = trainData.DropLastColumn(context);
4239
validationData = validationData.DropLastColumn(context);
4340
return (trainData, validationData);
4441
}
4542

46-
public static IDataView Skip(this IDataView data, MLContext context, int count)
47-
{
48-
return SkipFilter.Create(context, data, count);
49-
}
50-
51-
public static (string, ColumnType, ColumnPurpose, ColumnDimensions)[] GetColumnInfoTuples(MLContext context,
43+
public static (string, DataViewType, ColumnPurpose, ColumnDimensions)[] GetColumnInfoTuples(MLContext context,
5244
IDataView data, ColumnInformation columnInfo)
5345
{
5446
var purposes = PurposeInference.InferPurposes(context, data, columnInfo);
5547
var colDimensions = DatasetDimensionsApi.CalcColumnDimensions(context, data, purposes);
56-
var cols = new (string, ColumnType, ColumnPurpose, ColumnDimensions)[data.Schema.Count];
48+
var cols = new (string, DataViewType, ColumnPurpose, ColumnDimensions)[data.Schema.Count];
5749
for (var i = 0; i < cols.Length; i++)
5850
{
5951
var schemaCol = data.Schema[i];

src/Microsoft.ML.Auto/ColumnInference/ColumnInferenceApi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static ColumnInferenceResults InferColumns(MLContext context, string path
5252
var loaderColumns = ColumnTypeInference.GenerateLoaderColumns(typeInference.Columns);
5353
var typedLoaderArgs = new TextLoader.Arguments
5454
{
55-
Column = loaderColumns,
55+
Columns = loaderColumns,
5656
Separators = new[] { splitInference.Separator.Value },
5757
AllowSparse = splitInference.AllowSparse,
5858
AllowQuoting = splitInference.AllowQuote,
@@ -85,7 +85,7 @@ public static ColumnInferenceResults InferColumns(MLContext context, string path
8585

8686
var textLoaderArgs = new TextLoader.Arguments()
8787
{
88-
Column = columnResults.ToArray(),
88+
Columns = columnResults.ToArray(),
8989
AllowQuoting = splitInference.AllowQuote,
9090
AllowSparse = splitInference.AllowSparse,
9191
Separators = new char[] { splitInference.Separator.Value },

src/Microsoft.ML.Auto/ColumnInference/ColumnInformationUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ internal static ColumnInformation BuildColumnInfo(IEnumerable<(string name, Colu
8282
return columnInfo;
8383
}
8484

85-
public static ColumnInformation BuildColumnInfo(IEnumerable<(string, ColumnType, ColumnPurpose, ColumnDimensions)> columns)
85+
public static ColumnInformation BuildColumnInfo(IEnumerable<(string, DataViewType, ColumnPurpose, ColumnDimensions)> columns)
8686
{
8787
return BuildColumnInfo(columns.Select(c => (c.Item1, c.Item3)));
8888
}

src/Microsoft.ML.Auto/ColumnInference/ColumnTypeInference.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ private class IntermediateColumn
4343
{
4444
private readonly ReadOnlyMemory<char>[] _data;
4545
private readonly int _columnId;
46-
private PrimitiveType _suggestedType;
46+
private PrimitiveDataViewType _suggestedType;
4747
private bool? _hasHeader;
4848

4949
public int ColumnId
5050
{
5151
get { return _columnId; }
5252
}
5353

54-
public PrimitiveType SuggestedType
54+
public PrimitiveDataViewType SuggestedType
5555
{
5656
get { return _suggestedType; }
5757
set { _suggestedType = value; }
@@ -95,10 +95,10 @@ public class Column
9595
{
9696
public readonly int ColumnIndex;
9797

98-
public PrimitiveType ItemType;
98+
public PrimitiveDataViewType ItemType;
9999
public string SuggestedName;
100100

101-
public Column(int columnIndex, string suggestedName, PrimitiveType itemType)
101+
public Column(int columnIndex, string suggestedName, PrimitiveDataViewType itemType)
102102
{
103103
ColumnIndex = columnIndex;
104104
SuggestedName = suggestedName;
@@ -160,7 +160,7 @@ public void Apply(IntermediateColumn[] columns)
160160
continue;
161161
}
162162

163-
col.SuggestedType = BoolType.Instance;
163+
col.SuggestedType = BooleanDataViewType.Instance;
164164
bool first;
165165

166166
col.HasHeader = !Conversions.TryParse(in col.RawData[0], out first);
@@ -185,7 +185,7 @@ public void Apply(IntermediateColumn[] columns)
185185
continue;
186186
}
187187

188-
col.SuggestedType = NumberType.R4;
188+
col.SuggestedType = NumberDataViewType.Single;
189189

190190
var headerStr = col.RawData[0].ToString();
191191
col.HasHeader = !double.TryParse(headerStr, out var doubleVal);
@@ -202,7 +202,7 @@ public void Apply(IntermediateColumn[] columns)
202202
if (col.SuggestedType != null)
203203
continue;
204204

205-
col.SuggestedType = TextType.Instance;
205+
col.SuggestedType = TextDataViewType.Instance;
206206
col.HasHeader = IsLookLikeHeader(col.RawData[0]);
207207
}
208208
}
@@ -258,14 +258,14 @@ private static InferenceResult InferTextFileColumnTypesCore(MLContext context, I
258258
// read the file as the specified number of text columns
259259
var textLoaderArgs = new TextLoader.Arguments
260260
{
261-
Column = new[] { new TextLoader.Column("C", DataKind.TX, 0, args.ColumnCount - 1) },
261+
Columns = new[] { new TextLoader.Column("C", DataKind.TX, 0, args.ColumnCount - 1) },
262262
Separators = new[] { args.Separator },
263263
AllowSparse = args.AllowSparse,
264264
AllowQuoting = args.AllowQuote,
265265
};
266266
var textLoader = new TextLoader(context, textLoaderArgs);
267267
var idv = textLoader.Read(fileSource);
268-
idv = idv.Take(context, args.MaxRowsToRead);
268+
idv = context.Data.TakeRows(idv, args.MaxRowsToRead);
269269

270270
// read all the data into memory.
271271
// list items are rows of the dataset.
@@ -361,7 +361,7 @@ private static InferenceResult InferTextFileColumnTypesCore(MLContext context, I
361361
// if label column has all Boolean values, set its type as Boolean
362362
if (labelColumn.HasAllBooleanValues())
363363
{
364-
labelColumn.SuggestedType = BoolType.Instance;
364+
labelColumn.SuggestedType = BooleanDataViewType.Instance;
365365
}
366366

367367
var outCols = cols.Select(x => new Column(x.ColumnId, x.Name, x.SuggestedType)).ToArray();

0 commit comments

Comments
 (0)