Skip to content

Commit

Permalink
Remove append calls since they not compatible with 4.6 framework (#2643)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivanidzo4ka authored and TomFinley committed Feb 20, 2019
1 parent 6c9a887 commit 4a71e50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/Microsoft.ML.Data/Training/TrainerUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,17 +228,17 @@ public static void CheckOptGroup(this RoleMappedData data)
Contracts.AssertValueOrNull(extraCols);

var columns = extraCols == null ?
Enumerable.Empty<DataViewSchema.Column>() :
data.Data.Schema.Where(c => extraCols.Contains(c.Index));
new List<DataViewSchema.Column>() :
data.Data.Schema.Where(c => extraCols.Contains(c.Index)).ToList();

if ((opt & CursOpt.Label) != 0 && data.Schema.Label.HasValue)
columns = columns.Append(data.Schema.Label.Value);
columns.Add(data.Schema.Label.Value);
if ((opt & CursOpt.Features) != 0 && data.Schema.Feature.HasValue)
columns = columns.Append(data.Schema.Feature.Value);
columns.Add(data.Schema.Feature.Value);
if ((opt & CursOpt.Weight) != 0 && data.Schema.Weight.HasValue)
columns = columns.Append(data.Schema.Weight.Value);
columns.Add(data.Schema.Weight.Value);
if ((opt & CursOpt.Group) != 0 && data.Schema.Group.HasValue)
columns = columns.Append(data.Schema.Group.Value);
columns.Add(data.Schema.Group.Value);
return columns;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,10 @@ private static double CalculateAvgLoss(IChannel ch, RoleMappedData data, bool no
badExampleCount = 0;
int count = 0;

var columns = featureColumns.Append(data.Schema.Label.Value);
var columns = new List<DataViewSchema.Column>(featureColumns);
columns.Add(data.Schema.Label.Value);
if (data.Schema.Weight != null)
columns.Append(data.Schema.Weight.Value);
columns.Add(data.Schema.Weight.Value);

using (var cursor = data.Data.GetRowCursor(columns))
{
Expand Down

0 comments on commit 4a71e50

Please sign in to comment.