Skip to content

Commit e2f7075

Browse files
authored
Remove legacy project and related stuff. (#2043)
1 parent faffd17 commit e2f7075

File tree

77 files changed

+64
-28943
lines changed

Some content is hidden

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

77 files changed

+64
-28943
lines changed

Microsoft.ML.sln

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.StandardLearne
2323
EndProject
2424
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Transforms", "src\Microsoft.ML.Transforms\Microsoft.ML.Transforms.csproj", "{2911A286-ECA4-4730-97A9-DA1FEE2DED97}"
2525
EndProject
26-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Legacy", "src\Microsoft.ML.Legacy\Microsoft.ML.Legacy.csproj", "{7288C084-11C0-43BE-AC7F-45DCFEAEEBF6}"
27-
EndProject
2826
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.KMeansClustering", "src\Microsoft.ML.KMeansClustering\Microsoft.ML.KMeansClustering.csproj", "{F1CAE3AB-4F86-4BC0-BBA8-C4A58E7E8A4A}"
2927
EndProject
3028
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.PCA", "src\Microsoft.ML.PCA\Microsoft.ML.PCA.csproj", "{58E06735-1129-4DD5-86E0-6BBFF049AAD9}"
@@ -147,7 +145,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.HalLearners.St
147145
EndProject
148146
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.OnnxTransform.StaticPipe", "src\Microsoft.ML.OnnxTransform.StaticPipe\Microsoft.ML.OnnxTransform.StaticPipe.csproj", "{D1324668-9568-40F4-AA55-30A9A516C230}"
149147
EndProject
150-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.ML.LightGBM.StaticPipe", "src\Microsoft.ML.LightGBM.StaticPipe\Microsoft.ML.LightGBM.StaticPipe.csproj", "{22C51B08-ACAE-47B2-A312-462DC239A23B}"
148+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.LightGBM.StaticPipe", "src\Microsoft.ML.LightGBM.StaticPipe\Microsoft.ML.LightGBM.StaticPipe.csproj", "{22C51B08-ACAE-47B2-A312-462DC239A23B}"
151149
EndProject
152150
Global
153151
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -213,14 +211,6 @@ Global
213211
{2911A286-ECA4-4730-97A9-DA1FEE2DED97}.Release|Any CPU.Build.0 = Release|Any CPU
214212
{2911A286-ECA4-4730-97A9-DA1FEE2DED97}.Release-Intrinsics|Any CPU.ActiveCfg = Release-Intrinsics|Any CPU
215213
{2911A286-ECA4-4730-97A9-DA1FEE2DED97}.Release-Intrinsics|Any CPU.Build.0 = Release-Intrinsics|Any CPU
216-
{7288C084-11C0-43BE-AC7F-45DCFEAEEBF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
217-
{7288C084-11C0-43BE-AC7F-45DCFEAEEBF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
218-
{7288C084-11C0-43BE-AC7F-45DCFEAEEBF6}.Debug-Intrinsics|Any CPU.ActiveCfg = Debug-Intrinsics|Any CPU
219-
{7288C084-11C0-43BE-AC7F-45DCFEAEEBF6}.Debug-Intrinsics|Any CPU.Build.0 = Debug-Intrinsics|Any CPU
220-
{7288C084-11C0-43BE-AC7F-45DCFEAEEBF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
221-
{7288C084-11C0-43BE-AC7F-45DCFEAEEBF6}.Release|Any CPU.Build.0 = Release|Any CPU
222-
{7288C084-11C0-43BE-AC7F-45DCFEAEEBF6}.Release-Intrinsics|Any CPU.ActiveCfg = Release-Intrinsics|Any CPU
223-
{7288C084-11C0-43BE-AC7F-45DCFEAEEBF6}.Release-Intrinsics|Any CPU.Build.0 = Release-Intrinsics|Any CPU
224214
{F1CAE3AB-4F86-4BC0-BBA8-C4A58E7E8A4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
225215
{F1CAE3AB-4F86-4BC0-BBA8-C4A58E7E8A4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
226216
{F1CAE3AB-4F86-4BC0-BBA8-C4A58E7E8A4A}.Debug-Intrinsics|Any CPU.ActiveCfg = Debug-Intrinsics|Any CPU
@@ -593,7 +583,6 @@ Global
593583
{65D0603E-B96C-4DFC-BDD1-705891B88C18} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
594584
{707BB22C-7E5F-497A-8C2F-74578F675705} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
595585
{2911A286-ECA4-4730-97A9-DA1FEE2DED97} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
596-
{7288C084-11C0-43BE-AC7F-45DCFEAEEBF6} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
597586
{F1CAE3AB-4F86-4BC0-BBA8-C4A58E7E8A4A} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
598587
{58E06735-1129-4DD5-86E0-6BBFF049AAD9} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
599588
{64BC22D3-1E76-41EF-94D8-C79E471FF2DD} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}

src/Microsoft.ML.Core/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.OnnxTransformTest" + PublicKey.TestValue)]
1616

1717
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.EntryPoints" + PublicKey.Value)]
18-
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.Legacy" + PublicKey.Value)]
1918
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.Maml" + PublicKey.Value)]
2019
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.ResultProcessor" + PublicKey.Value)]
2120
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.CpuMath" + PublicKey.Value)]

src/Microsoft.ML.Data/Data/RowCursorUtils.cs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -325,30 +325,6 @@ private static Func<bool> GetIsNewGroupDelegateCore<T>(Row cursor, int col)
325325
};
326326
}
327327

328-
[Obsolete("The usages of this appear to be based on a total misunderstanding of what Batch actually is. It is a mechanism " +
329-
"to enable sharding and recovery of parallelized data, and has nothing to do with actual data.")]
330-
[BestFriend]
331-
internal static Func<bool> GetIsNewBatchDelegate(Row cursor, int batchSize)
332-
{
333-
Contracts.CheckParam(batchSize > 0, nameof(batchSize), "Batch size must be > 0");
334-
long lastNewBatchPosition = -1;
335-
return () =>
336-
{
337-
if (cursor.Position % batchSize != 0)
338-
return false;
339-
340-
// If the cursor just moved to a new batch, we need to return true.
341-
if (lastNewBatchPosition != cursor.Position)
342-
{
343-
lastNewBatchPosition = cursor.Position;
344-
return true;
345-
}
346-
347-
// The cursor is already in the new batch, if the condition is tested again, we need to return false.
348-
return false;
349-
};
350-
}
351-
352328
public static string TestGetLabelGetter(ColumnType type)
353329
{
354330
return TestGetLabelGetter(type, true);

src/Microsoft.ML.Data/DataLoadSave/Text/LoadColumnAttribute.cs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
namespace Microsoft.ML.Data
99
{
10-
// REVIEW: The Start field is decorated with [Obsolete], and this warning disables using Obsolete for this class.
11-
// The Start field should get deleted together with the Legacy API.
12-
#pragma warning disable 618
1310
/// <summary>
1411
/// Describes column information such as name and the source columns indices that this
1512
/// column encapsulates.
@@ -21,11 +18,9 @@ public sealed class LoadColumnAttribute : Attribute
2118
/// Initializes new instance of <see cref="LoadColumnAttribute"/>.
2219
/// </summary>
2320
/// <param name="columnIndex">The index of the column in the text file.</param>
24-
// REVIEW: Remove calling the private constructor with just the start parameter,
25-
// when the Legacy API's TextLoader gets deleted, and with it the Start field here.
2621
public LoadColumnAttribute(int columnIndex)
27-
: this(columnIndex.ToString())
2822
{
23+
Sources = new List<TextLoader.Range>();
2924
Sources.Add(new TextLoader.Range(columnIndex));
3025
}
3126

@@ -34,39 +29,23 @@ public LoadColumnAttribute(int columnIndex)
3429
/// </summary>
3530
/// <param name="start">The starting column index, for the range.</param>
3631
/// <param name="end">The ending column index, for the range.</param>
37-
// REVIEW: Calling the private constructor with just the start parameter, is incorrect,
38-
// but it is just temporary there, until the Legacy API's TextLoader gets deleted, together with the Start field.
3932
public LoadColumnAttribute(int start, int end)
40-
: this(start.ToString())
4133
{
34+
Sources = new List<TextLoader.Range>();
4235
Sources.Add(new TextLoader.Range(start, end));
4336
}
4437

4538
/// <summary>
4639
/// Initializes new instance of <see cref="LoadColumnAttribute"/>.
4740
/// </summary>
4841
/// <param name="columnIndexes">Distinct text file column indices to load as part of this column.</param>
49-
// REVIEW: Calling the private constructor with just the columnIndexes[0] parameter, is incorrect,
50-
// but it is just temporary there, until the Legacy API's TextLoader gets deleted together with the Start field.
5142
public LoadColumnAttribute(int[] columnIndexes)
52-
: this(columnIndexes[0].ToString()) // REVIEW: this is incorrect, but it is just temporary there, until the Legacy API's TextLoader gets deleted.
5343
{
44+
Sources = new List<TextLoader.Range>();
5445
foreach (var col in columnIndexes)
5546
Sources.Add(new TextLoader.Range(col));
5647
}
5748

58-
[Obsolete("Should be deleted together with the Legacy project.")]
59-
private LoadColumnAttribute(string start)
60-
{
61-
Sources = new List<TextLoader.Range>();
62-
Start = start;
63-
}
64-
6549
internal List<TextLoader.Range> Sources;
66-
67-
[Obsolete("Should be deleted together with the Legacy project.")]
68-
[BestFriend]
69-
internal string Start { get; }
7050
}
71-
#pragma warning restore 618
7251
}

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,8 @@ protected override bool MoveManyCore(long count)
644644
/// <summary>
645645
/// An in-memory data view based on the IEnumerable of data.
646646
/// Doesn't support shuffling.
647-
///
648-
/// This class is public because prediction engine wants to call its <see cref="SetData"/>
649-
/// for performance reasons.
650647
/// </summary>
651-
public sealed class StreamingDataView<TRow> : DataViewBase<TRow>
648+
internal sealed class StreamingDataView<TRow> : DataViewBase<TRow>
652649
where TRow : class
653650
{
654651
private IEnumerable<TRow> _data;
@@ -675,18 +672,6 @@ public override RowCursor GetRowCursor(Func<int, bool> predicate, Random rand =
675672
return new WrappedCursor (new Cursor(Host, this, predicate));
676673
}
677674

678-
/// <summary>
679-
/// Since all the cursors only depend on an enumerator (rather than the data itself),
680-
/// it's safe to 'swap' the data inside the streaming data view. This doesn't affect
681-
/// the current 'live' cursors, only the ones that will be created later.
682-
/// This is used for efficiency in <see cref="BatchPredictionEngine{TSrc,TDst}"/>.
683-
/// </summary>
684-
public void SetData(IEnumerable<TRow> data)
685-
{
686-
Contracts.CheckValue(data, nameof(data));
687-
_data = data;
688-
}
689-
690675
private sealed class Cursor : DataViewCursorBase
691676
{
692677
private readonly IEnumerator<TRow> _enumerator;

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

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -10,73 +10,6 @@
1010

1111
namespace Microsoft.ML
1212
{
13-
// REVIEW: Temporarly moving here since it is used by the Legacy project. Remove when removing the legacy project.
14-
/// <summary>
15-
/// A class that runs the previously trained model (and the preceding transform pipeline) on the
16-
/// in-memory data in batch mode.
17-
/// This can also be used with trained pipelines that do not end with a predictor: in this case, the
18-
/// 'prediction' will be just the outcome of all the transformations.
19-
/// </summary>
20-
/// <typeparam name="TSrc">The user-defined type that holds the example.</typeparam>
21-
/// <typeparam name="TDst">The user-defined type that holds the prediction.</typeparam>
22-
[BestFriend]
23-
internal sealed class BatchPredictionEngine<TSrc, TDst>
24-
where TSrc : class
25-
where TDst : class, new()
26-
{
27-
// The source data view.
28-
private readonly DataViewConstructionUtils.StreamingDataView<TSrc> _srcDataView;
29-
// The transformation engine.
30-
private readonly PipeEngine<TDst> _pipeEngine;
31-
32-
internal BatchPredictionEngine(IHostEnvironment env, Stream modelStream, bool ignoreMissingColumns,
33-
SchemaDefinition inputSchemaDefinition = null, SchemaDefinition outputSchemaDefinition = null)
34-
{
35-
Contracts.AssertValue(env);
36-
Contracts.AssertValue(modelStream);
37-
Contracts.AssertValueOrNull(inputSchemaDefinition);
38-
Contracts.AssertValueOrNull(outputSchemaDefinition);
39-
40-
// Initialize pipe.
41-
_srcDataView = DataViewConstructionUtils.CreateFromEnumerable(env, new TSrc[] { }, inputSchemaDefinition);
42-
var pipe = DataViewConstructionUtils.LoadPipeWithPredictor(env, modelStream, _srcDataView);
43-
_pipeEngine = new PipeEngine<TDst>(env, pipe, ignoreMissingColumns, outputSchemaDefinition);
44-
}
45-
46-
internal BatchPredictionEngine(IHostEnvironment env, IDataView dataPipeline, bool ignoreMissingColumns,
47-
SchemaDefinition inputSchemaDefinition = null, SchemaDefinition outputSchemaDefinition = null)
48-
{
49-
Contracts.AssertValue(env);
50-
Contracts.AssertValue(dataPipeline);
51-
Contracts.AssertValueOrNull(inputSchemaDefinition);
52-
Contracts.AssertValueOrNull(outputSchemaDefinition);
53-
54-
// Initialize pipe.
55-
_srcDataView = DataViewConstructionUtils.CreateFromEnumerable(env, new TSrc[] { }, inputSchemaDefinition);
56-
var pipe = ApplyTransformUtils.ApplyAllTransformsToData(env, dataPipeline, _srcDataView);
57-
58-
_pipeEngine = new PipeEngine<TDst>(env, pipe, ignoreMissingColumns, outputSchemaDefinition);
59-
}
60-
61-
/// <summary>
62-
/// Run the prediction pipe. This will enumerate the <paramref name="examples"/> exactly once,
63-
/// cache all the examples (by reference) into its internal representation and then run
64-
/// the transformation pipe.
65-
/// </summary>
66-
/// <param name="examples">The examples to run the prediction on.</param>
67-
/// <param name="reuseRowObjects">If <c>true</c>, the engine will not allocate memory per output, and
68-
/// the returned <typeparamref name="TDst"/> objects will actually always be the same object. The user is
69-
/// expected to clone the values himself if needed.</param>
70-
/// <returns>The <see cref="IEnumerable{TDst}"/> that contains all the pipeline results.</returns>
71-
public IEnumerable<TDst> Predict(IEnumerable<TSrc> examples, bool reuseRowObjects)
72-
{
73-
Contracts.CheckValue(examples, nameof(examples));
74-
75-
_pipeEngine.Reset();
76-
_srcDataView.SetData(examples);
77-
return _pipeEngine.RunPipe(reuseRowObjects);
78-
}
79-
}
8013

8114
/// <summary>
8215
/// Utility class to run the pipeline to completion and produce a strongly-typed IEnumerable as a result.

src/Microsoft.ML.Data/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.TimeSeries.Tests" + PublicKey.TestValue)]
1515

1616
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.EntryPoints" + PublicKey.Value)]
17-
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.Legacy" + PublicKey.Value)]
1817
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.Maml" + PublicKey.Value)]
1918
[assembly: InternalsVisibleTo(assemblyName: "Microsoft.ML.ResultProcessor" + PublicKey.Value)]
2019

src/Microsoft.ML.Data/Utilities/ComponentCreation.cs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public static IDataView CreateDataView<TRow>(this IHostEnvironment env, IList<TR
9393
///
9494
/// One typical usage for streaming data view could be: create the data view that lazily loads data
9595
/// as needed, then apply pre-trained transformations to it and cursor through it for transformation
96-
/// results. This is how <see cref="BatchPredictionEngine{TSrc,TDst}"/> is implemented.
96+
/// results.
9797
/// </summary>
9898
/// <typeparam name="TRow">The user-defined item type.</typeparam>
9999
/// <param name="env">The host environment to use for data view creation.</param>
@@ -110,46 +110,6 @@ public static IDataView CreateStreamingDataView<TRow>(this IHostEnvironment env,
110110
return DataViewConstructionUtils.CreateFromEnumerable(env, data, schemaDefinition);
111111
}
112112

113-
/// <summary>
114-
/// Create a batch prediction engine.
115-
/// </summary>
116-
/// <param name="env">The host environment to use.</param>
117-
/// <param name="modelStream">The stream to deserialize the pipeline (transforms and predictor) from.</param>
118-
/// <param name="ignoreMissingColumns">Whether to ignore missing columns in the data view.</param>
119-
/// <param name="inputSchemaDefinition">The optional input schema. If <c>null</c>, the schema is inferred from the <typeparamref name="TSrc"/> type.</param>
120-
/// <param name="outputSchemaDefinition">The optional output schema. If <c>null</c>, the schema is inferred from the <typeparamref name="TDst"/> type.</param>
121-
internal static BatchPredictionEngine<TSrc, TDst> CreateBatchPredictionEngine<TSrc, TDst>(this IHostEnvironment env, Stream modelStream,
122-
bool ignoreMissingColumns = false, SchemaDefinition inputSchemaDefinition = null, SchemaDefinition outputSchemaDefinition = null)
123-
where TSrc : class
124-
where TDst : class, new()
125-
{
126-
Contracts.CheckValue(env, nameof(env));
127-
env.CheckValue(modelStream, nameof(modelStream));
128-
env.CheckValueOrNull(inputSchemaDefinition);
129-
env.CheckValueOrNull(outputSchemaDefinition);
130-
return new BatchPredictionEngine<TSrc, TDst>(env, modelStream, ignoreMissingColumns, inputSchemaDefinition, outputSchemaDefinition);
131-
}
132-
133-
/// <summary>
134-
/// Create a batch prediction engine.
135-
/// </summary>
136-
/// <param name="env">The host environment to use.</param>
137-
/// <param name="dataPipe">The transformation pipe that may or may not include a scorer.</param>
138-
/// <param name="ignoreMissingColumns">Whether to ignore missing columns in the data view.</param>
139-
/// <param name="inputSchemaDefinition">The optional input schema. If <c>null</c>, the schema is inferred from the <typeparamref name="TSrc"/> type.</param>
140-
/// <param name="outputSchemaDefinition">The optional output schema. If <c>null</c>, the schema is inferred from the <typeparamref name="TDst"/> type.</param>
141-
internal static BatchPredictionEngine<TSrc, TDst> CreateBatchPredictionEngine<TSrc, TDst>(this IHostEnvironment env, IDataView dataPipe,
142-
bool ignoreMissingColumns = false, SchemaDefinition inputSchemaDefinition = null, SchemaDefinition outputSchemaDefinition = null)
143-
where TSrc : class
144-
where TDst : class, new()
145-
{
146-
Contracts.CheckValue(env, nameof(env));
147-
env.CheckValue(dataPipe, nameof(dataPipe));
148-
env.CheckValueOrNull(inputSchemaDefinition);
149-
env.CheckValueOrNull(outputSchemaDefinition);
150-
return new BatchPredictionEngine<TSrc, TDst>(env, dataPipe, ignoreMissingColumns, inputSchemaDefinition, outputSchemaDefinition);
151-
}
152-
153113
/// <summary>
154114
/// Create an on-demand prediction engine.
155115
/// </summary>

src/Microsoft.ML.EntryPoints/CrossValidationMacro.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
[assembly: LoadableClass(typeof(void), typeof(CrossValidationMacro), null, typeof(SignatureEntryPointModule), "CrossValidationMacro")]
1616

17-
// The warning #612 is disabled because the following code uses a lot of things in Legacy.Models and Legacy.Transforms while Legacy is marked as obsolete.
18-
// Because that dependency will be removed form ML.NET, one needs to rewrite all places where legacy APIs are used.
19-
#pragma warning disable 612
2017
namespace Microsoft.ML.EntryPoints
2118
{
2219

0 commit comments

Comments
 (0)