Skip to content

Commit 9a8e4b0

Browse files
committed
Replace other few miscellaneous usages of ColumnInfo with Schema.Column.
1 parent 671de0b commit 9a8e4b0

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

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

@@ -305,7 +304,7 @@ public SchemaImpl(Transposer parent)
305304
_slotTypes = new VectorType[_parent._cols.Length];
306305
for (int c = 0; c < _slotTypes.Length; ++c)
307306
{
308-
ColumnInfo srcInfo = _parent._cols[c];
307+
var srcInfo = _parent._cols[c];
309308
var ctype = srcInfo.Type.ItemType;
310309
var primitiveType = ctype as PrimitiveType;
311310
_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)