Skip to content

Commit 87cc69d

Browse files
committed
Replace other few miscellaneous usages of ColumnInfo with Schema.Column.
1 parent 73986c9 commit 87cc69d

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Linq;
99
using System.Reflection;
1010
using Microsoft.ML.Data;
11-
using Microsoft.ML.Runtime.CommandLine;
1211
using Microsoft.ML.Runtime.Data.IO;
1312
using Microsoft.ML.Runtime.Internal.Utilities;
1413

@@ -35,7 +34,7 @@ public sealed class Transposer : ITransposeDataView, IDisposable
3534
public readonly int RowCount;
3635
// -1 for input columns that were not transposed, a non-negative index into _cols for those that were.
3736
private readonly int[] _inputToTransposed;
38-
private readonly ColumnInfo[] _cols;
37+
private readonly Schema.Column[] _cols;
3938
private readonly int[] _splitLim;
4039
private readonly SchemaImpl _tschema;
4140
private bool _disposed;
@@ -103,13 +102,13 @@ private Transposer(IHost host, IDataView view, bool forceSave, int[] columns)
103102
columnSet = columnSet.Where(c => ttschema.GetSlotType(c) == null);
104103
}
105104
columns = columnSet.ToArray();
106-
_cols = new ColumnInfo[columns.Length];
105+
_cols = new Schema.Column[columns.Length];
107106
var schema = _view.Schema;
108107
_nameToICol = new Dictionary<string, int>();
109108
_inputToTransposed = Utils.CreateArray(schema.Count, -1);
110109
for (int c = 0; c < columns.Length; ++c)
111110
{
112-
_nameToICol[(_cols[c] = ColumnInfo.CreateFromIndex(schema, columns[c])).Name] = c;
111+
_nameToICol[(_cols[c] = schema[columns[c]]).Name] = c;
113112
_inputToTransposed[columns[c]] = c;
114113
}
115114

@@ -304,7 +303,7 @@ public SchemaImpl(Transposer parent)
304303
_slotTypes = new VectorType[_parent._cols.Length];
305304
for (int c = 0; c < _slotTypes.Length; ++c)
306305
{
307-
ColumnInfo srcInfo = _parent._cols[c];
306+
var srcInfo = _parent._cols[c];
308307
var ctype = srcInfo.Type.ItemType;
309308
var primitiveType = ctype as PrimitiveType;
310309
_ectx.Assert(primitiveType != null);

src/Microsoft.ML.Recommender/RecommenderUtils.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
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 System.Threading;
65
using Microsoft.ML.Data;
76
using Microsoft.ML.Runtime.Data;
87
using Microsoft.ML.Runtime.Internal.Utilities;
@@ -13,7 +12,7 @@ internal static class RecommenderUtils
1312
{
1413
/// <summary>
1514
/// Check if the considered data, <see cref="RoleMappedData"/>, contains column roles specified by <see cref="MatrixColumnIndexKind"/> and <see cref="MatrixRowIndexKind"/>.
16-
/// If the column roles, <see cref="MatrixColumnIndexKind"/> and <see cref="MatrixRowIndexKind"/>, uniquely exist in data, their <see cref="ColumnInfo"/> would be assigned
15+
/// If the column roles, <see cref="MatrixColumnIndexKind"/> and <see cref="MatrixRowIndexKind"/>, uniquely exist in data, their <see cref="Schema.Column"/> would be assigned
1716
/// to the two out parameters below.
1817
/// </summary>
1918
/// <param name="data">The considered data being checked</param>
@@ -39,8 +38,8 @@ private static bool TryMarshalGoodRowColumnType(ColumnType type, out KeyType key
3938
}
4039

4140
/// <summary>
42-
/// Checks whether a column kind in a RoleMappedData is unique, and its type
43-
/// is a U4 key of known cardinality.
41+
/// Checks whether a column kind in a <see cref="RoleMappedData"/> is unique, and its type
42+
/// is a <see cref="DataKind.U4"/> key of known cardinality.
4443
/// </summary>
4544
/// <param name="data">The training examples</param>
4645
/// <param name="role">The column role to try to extract</param>

0 commit comments

Comments
 (0)