Skip to content

Commit 4773889

Browse files
committed
post rebase fixes.
1 parent 8987284 commit 4773889

File tree

19 files changed

+60
-54
lines changed

19 files changed

+60
-54
lines changed

src/Microsoft.ML.Core/Data/IRowToRowMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public interface IRowToRowMapper
3131
/// <summary>
3232
/// Given a set of columns, return the input columns that are needed to generate those output columns.
3333
/// </summary>
34-
IEnumerable<Schema.Column> GetDependencies(IEnumerable<Schema.Column> dependingColumns);
34+
IEnumerable<DataViewSchema.Column> GetDependencies(IEnumerable<DataViewSchema.Column> dependingColumns);
3535

3636
/// <summary>
3737
/// Get an <see cref="DataViewRow"/> with the indicated active columns, based on the input <paramref name="input"/>.

src/Microsoft.ML.Data/DataView/CompositeRowToRowMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public CompositeRowToRowMapper(DataViewSchema inputSchema, IRowToRowMapper[] map
4141
/// <summary>
4242
/// Given a set of columns, return the input columns that are needed to generate those output columns.
4343
/// </summary>
44-
IEnumerable<Schema.Column> IRowToRowMapper.GetDependencies(IEnumerable<Schema.Column> columnsNeeded)
44+
IEnumerable<DataViewSchema.Column> IRowToRowMapper.GetDependencies(IEnumerable<DataViewSchema.Column> columnsNeeded)
4545
{
4646
for (int i = InnerMappers.Length - 1; i >= 0; --i)
4747
columnsNeeded = InnerMappers[i].GetDependencies(columnsNeeded);

src/Microsoft.ML.Data/DataView/RowToRowMapperTransform.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using Microsoft.ML.Data;
65
using System;
76
using System.Collections.Generic;
87
using System.IO;
98
using System.Linq;
9+
using Microsoft.Data.DataView;
10+
using Microsoft.ML;
11+
using Microsoft.ML.Data;
12+
using Microsoft.ML.Internal.Utilities;
13+
using Microsoft.ML.Model;
14+
using Microsoft.ML.Model.OnnxConverter;
15+
using Microsoft.ML.Model.Pfa;
1016

1117
[assembly: LoadableClass(typeof(RowToRowMapperTransform), null, typeof(SignatureLoadDataTransform),
1218
"", RowToRowMapperTransform.LoaderSignature)]
@@ -95,7 +101,7 @@ public RowToRowMapperTransform(IHostEnvironment env, IDataView input, IRowMapper
95101
_mapperFactory = mapperFactory;
96102
_bindings = new ColumnBindings(input.Schema, mapper.GetOutputColumns());
97103
}
98-
public static Schema GetOutputSchema(Schema inputSchema, IRowMapper mapper)
104+
public static DataViewSchema GetOutputSchema(DataViewSchema inputSchema, IRowMapper mapper)
99105
{
100106
Contracts.CheckValue(inputSchema, nameof(inputSchema));
101107
Contracts.CheckValue(mapper, nameof(mapper));
@@ -138,7 +144,7 @@ private protected override void SaveModel(ModelSaveContext ctx)
138144
/// Produces the set of active columns for the data view (as a bool[] of length bindings.ColumnCount),
139145
/// and the needed active input columns, given a predicate for the needed active output columns.
140146
/// </summary>
141-
private bool[] GetActive(Func<int, bool> predicate, out IEnumerable<Schema.Column> inputColumns)
147+
private bool[] GetActive(Func<int, bool> predicate, out IEnumerable<DataViewSchema.Column> inputColumns)
142148
{
143149
int n = _bindings.Schema.Count;
144150
var active = Utils.BuildArray(n, predicate);
@@ -180,20 +186,20 @@ private Func<int, bool> GetActiveOutputColumns(bool[] active)
180186
return null;
181187
}
182188

183-
protected override RowCursor GetRowCursorCore(IEnumerable<Schema.Column> columnsNeeded, Random rand = null)
189+
protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema.Column> columnsNeeded, Random rand = null)
184190
{
185191
var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
186-
var active = GetActive(predicate, out IEnumerable<Schema.Column> inputCols);
192+
var active = GetActive(predicate, out IEnumerable<DataViewSchema.Column> inputCols);
187193

188194
return new Cursor(Host, Source.GetRowCursor(inputCols, rand), this, active);
189195
}
190196

191-
public override RowCursor[] GetRowCursorSet(IEnumerable<Schema.Column> columnsNeeded, int n, Random rand = null)
197+
public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.Column> columnsNeeded, int n, Random rand = null)
192198
{
193199
Host.CheckValueOrNull(rand);
194200

195201
var predicate = RowCursorUtils.FromColumnsToPredicate(columnsNeeded, OutputSchema);
196-
var active = GetActive(predicate, out IEnumerable<Schema.Column> inputCols);
202+
var active = GetActive(predicate, out IEnumerable<DataViewSchema.Column> inputCols);
197203

198204
var inputs = Source.GetRowCursorSet(inputCols, n, rand);
199205
Host.AssertNonEmpty(inputs);
@@ -231,7 +237,7 @@ void ISaveAsPfa.SaveAsPfa(BoundPfaContext ctx)
231237
/// <summary>
232238
/// Given a set of output columns, return the input columns that are needed to generate those output columns.
233239
/// </summary>
234-
IEnumerable<Schema.Column> IRowToRowMapper.GetDependencies(IEnumerable<Schema.Column> dependingColumns)
240+
IEnumerable<DataViewSchema.Column> IRowToRowMapper.GetDependencies(IEnumerable<DataViewSchema.Column> dependingColumns)
235241
{
236242
var predicate = RowCursorUtils.FromColumnsToPredicate(dependingColumns, OutputSchema);
237243
GetActive(predicate, out var inputColumns);
@@ -240,7 +246,7 @@ void ISaveAsPfa.SaveAsPfa(BoundPfaContext ctx)
240246

241247
public DataViewSchema InputSchema => Source.Schema;
242248

243-
public Row GetRow(Row input, Func<int, bool> active)
249+
public DataViewRow GetRow(DataViewRow input, Func<int, bool> active)
244250
{
245251
Host.CheckValue(input, nameof(input));
246252
Host.CheckValue(active, nameof(active));

src/Microsoft.ML.Data/EntryPoints/TransformModelImpl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public static bool IsCompositeRowToRowMapper(IDataView chain)
226226
/// <summary>
227227
/// Given a set of columns, return the input columns that are needed to generate those output columns.
228228
/// </summary>
229-
IEnumerable<Schema.Column> IRowToRowMapper.GetDependencies(IEnumerable<Schema.Column> dependingColumns)
229+
IEnumerable<DataViewSchema.Column> IRowToRowMapper.GetDependencies(IEnumerable<DataViewSchema.Column> dependingColumns)
230230
{
231231
_ectx.Assert(IsCompositeRowToRowMapper(_chain));
232232

src/Microsoft.ML.Data/Prediction/Calibrator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,12 +618,12 @@ public Bound(IHostEnvironment env, SchemaBindableCalibratedModelParameters<TSubM
618618
/// <summary>
619619
/// Given a set of columns, return the input columns that are needed to generate those output columns.
620620
/// </summary>
621-
IEnumerable<Schema.Column> IRowToRowMapper.GetDependencies(IEnumerable<Schema.Column> dependingColumns)
621+
IEnumerable<DataViewSchema.Column> IRowToRowMapper.GetDependencies(IEnumerable<DataViewSchema.Column> dependingColumns)
622622
{
623623
if (dependingColumns.Count() > 0)
624624
return _predictor.GetDependencies(OutputSchema);
625625

626-
return Enumerable.Empty<Schema.Column>();
626+
return Enumerable.Empty<DataViewSchema.Column>();
627627
}
628628

629629
public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles()

src/Microsoft.ML.Data/Scorers/FeatureContributionCalculation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ public RowMapper(IHostEnvironment env, BindableMapper parent, RoleMappedSchema s
352352
/// <summary>
353353
/// Returns the input columns needed for the requested output columns.
354354
/// </summary>
355-
IEnumerable<Schema.Column> IRowToRowMapper.GetDependencies(IEnumerable<Schema.Column> dependingColumns)
355+
IEnumerable<DataViewSchema.Column> IRowToRowMapper.GetDependencies(IEnumerable<DataViewSchema.Column> dependingColumns)
356356
{
357357
if (dependingColumns.Count() == 0)
358-
return Enumerable.Empty<Schema.Column>();
358+
return Enumerable.Empty<DataViewSchema.Column>();
359359

360360
return Enumerable.Repeat(FeatureColumn, 1);
361361
}

src/Microsoft.ML.Data/Scorers/MultiClassClassifierScorer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private DataViewSchema DecorateOutputSchema(DataViewSchema partialSchema, int sc
330330
/// <summary>
331331
/// Given a set of columns, return the input columns that are needed to generate those output columns.
332332
/// </summary>
333-
IEnumerable<Schema.Column> IRowToRowMapper.GetDependencies(IEnumerable<Schema.Column> dependingColumns)
333+
IEnumerable<DataViewSchema.Column> IRowToRowMapper.GetDependencies(IEnumerable<DataViewSchema.Column> dependingColumns)
334334
=> _mapper.GetDependencies(dependingColumns);
335335

336336
public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles() => _mapper.GetInputColumnRoles();

src/Microsoft.ML.Data/Scorers/RowToRowScorerBase.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ internal IDataView ApplyToData(IHostEnvironment env, IDataView newSource)
8282
/// mapper columns.
8383
/// </summary>
8484
private static bool[] GetActive(BindingsBase bindings,
85-
IEnumerable<Schema.Column> columns,
86-
out IEnumerable<Schema.Column> inputColumns,
85+
IEnumerable<DataViewSchema.Column> columns,
86+
out IEnumerable<DataViewSchema.Column> inputColumns,
8787
out Func<int, bool> predicateMapper)
8888
{
8989
var active = bindings.GetActive(columns);
@@ -131,7 +131,7 @@ protected override DataViewRowCursor GetRowCursorCore(IEnumerable<DataViewSchema
131131

132132
var bindings = GetBindings();
133133
Func<int, bool> predicateMapper;
134-
var active = GetActive(bindings, columnsNeeded, out IEnumerable<Schema.Column> inputCols, out predicateMapper);
134+
var active = GetActive(bindings, columnsNeeded, out IEnumerable<DataViewSchema.Column> inputCols, out predicateMapper);
135135

136136
var input = Source.GetRowCursor(inputCols, rand);
137137
return new Cursor(Host, this, input, active, predicateMapper);
@@ -145,7 +145,7 @@ public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.C
145145

146146
var bindings = GetBindings();
147147
Func<int, bool> predicateMapper;
148-
var active = GetActive(bindings, columnsNeeded, out IEnumerable<Schema.Column> inputCols, out predicateMapper);
148+
var active = GetActive(bindings, columnsNeeded, out IEnumerable<DataViewSchema.Column> inputCols, out predicateMapper);
149149
var inputs = Source.GetRowCursorSet(inputCols, n, rand);
150150
Contracts.AssertNonEmpty(inputs);
151151

@@ -162,20 +162,20 @@ public override DataViewRowCursor[] GetRowCursorSet(IEnumerable<DataViewSchema.C
162162
protected override Delegate[] CreateGetters(DataViewRow input, Func<int, bool> active, out Action disp)
163163
{
164164
var bindings = GetBindings();
165-
IEnumerable<Schema.Column> inputColumns;
165+
IEnumerable<DataViewSchema.Column> inputColumns;
166166
Func<int, bool> predicateMapper;
167-
IEnumerable<Schema.Column> activeColumns = OutputSchema.Where(col => active(col.Index));
167+
IEnumerable<DataViewSchema.Column> activeColumns = OutputSchema.Where(col => active(col.Index));
168168
GetActive(bindings, activeColumns, out inputColumns, out predicateMapper);
169169
var output = bindings.RowMapper.GetRow(input, predicateMapper);
170170
Func<int, bool> activeInfos = iinfo => active(bindings.MapIinfoToCol(iinfo));
171171
disp = output.Dispose;
172172
return GetGetters(output, activeInfos);
173173
}
174174

175-
protected override IEnumerable<Schema.Column> GetDependenciesCore(IEnumerable<Schema.Column> columns)
175+
protected override IEnumerable<DataViewSchema.Column> GetDependenciesCore(IEnumerable<DataViewSchema.Column> columns)
176176
{
177177
var bindings = GetBindings();
178-
IEnumerable<Schema.Column> inputColumns;
178+
IEnumerable<DataViewSchema.Column> inputColumns;
179179
Func<int, bool> predicateMapper;
180180

181181
GetActive(bindings, columns, out inputColumns, out predicateMapper);

src/Microsoft.ML.Data/Scorers/SchemaBindablePredictorWrapper.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ public SingleValueRowMapper(RoleMappedSchema schema, SchemaBindablePredictorWrap
218218
/// <summary>
219219
/// Given a set of columns, return the input columns that are needed to generate those output columns.
220220
/// </summary>
221-
IEnumerable<Schema.Column> IRowToRowMapper.GetDependencies(IEnumerable<Schema.Column> dependingColumns)
221+
IEnumerable<DataViewSchema.Column> IRowToRowMapper.GetDependencies(IEnumerable<DataViewSchema.Column> dependingColumns)
222222
{
223223
if (!InputRoleMappedSchema.Feature.HasValue || dependingColumns.Count() == 0)
224-
return Enumerable.Empty<Schema.Column>();
224+
return Enumerable.Empty<DataViewSchema.Column>();
225225

226226
return InputSchema.Where(col => col.Index == InputRoleMappedSchema.Feature.Value.Index);
227227
}
@@ -502,11 +502,11 @@ public CalibratedRowMapper(RoleMappedSchema schema, SchemaBindableBinaryPredicto
502502
/// <summary>
503503
/// Given a set of columns, return the input columns that are needed to generate those output columns.
504504
/// </summary>
505-
IEnumerable<Schema.Column> IRowToRowMapper.GetDependencies(IEnumerable<Schema.Column> dependingColumns)
505+
IEnumerable<DataViewSchema.Column> IRowToRowMapper.GetDependencies(IEnumerable<DataViewSchema.Column> dependingColumns)
506506
{
507507

508508
if (dependingColumns.Count() == 0 || !InputRoleMappedSchema.Feature.HasValue)
509-
return Enumerable.Empty<Schema.Column>();
509+
return Enumerable.Empty<DataViewSchema.Column>();
510510

511511
return InputSchema.Where(col => col.Index == InputRoleMappedSchema.Feature.Value.Index);
512512
}

src/Microsoft.ML.Data/Transforms/ColumnBindingsBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ public bool[] GetActive(Func<int, bool> predicate)
596596
/// This builds an array of bools of length ColumnCount containing the results of calling
597597
/// predicate on each column index.
598598
/// </summary>
599-
public bool[] GetActive(IEnumerable<Schema.Column> columns)
599+
public bool[] GetActive(IEnumerable<DataViewSchema.Column> columns)
600600
{
601601
return Utils.BuildArray(ColumnCount, columns);
602602
}
@@ -626,7 +626,7 @@ public bool[] GetActiveInput(Func<int, bool> predicate)
626626
/// This builds an array of bools of length Input.ColumnCount containing the results of calling
627627
/// predicate on the output column index corresponding to each input column index.
628628
/// </summary>
629-
public bool[] GetActiveInput(IEnumerable<Schema.Column> inputColumns)
629+
public bool[] GetActiveInput(IEnumerable<DataViewSchema.Column> inputColumns)
630630
{
631631
Contracts.AssertValue(inputColumns);
632632
var predicate = RowCursorUtils.FromColumnsToPredicate(inputColumns, AsSchema);
@@ -794,7 +794,7 @@ public bool[] GetActiveInput(Func<int, bool> predicate)
794794
/// This builds an array of bools of length Input.ColumnCount containing the results of calling
795795
/// predicate on the output column index corresponding to each input column index.
796796
/// </summary>
797-
public bool[] GetActiveInput(IEnumerable<Schema.Column> activeColumns)
797+
public bool[] GetActiveInput(IEnumerable<DataViewSchema.Column> activeColumns)
798798
{
799799
Contracts.AssertValue(activeColumns);
800800
var predicate = RowCursorUtils.FromColumnsToPredicate(activeColumns, Schema);

0 commit comments

Comments
 (0)