Skip to content

Commit 20b448b

Browse files
sfilipicodemzs
authored andcommitted
Splitting OLS to a separate package called AdditionalLearners (dotnet#611)
* moving Ols to a separate project * Revert "moving Ols to a separate project" This reverts commit 9b7eab3. * separating OLS in its own project * adding nupkgproj files to create a package for AdditionalLearners adding AdditionalLearners to the core.tests project fixing the core_ep and core_manifest * CSharpApi should not get generated every time. * Addressing Ivan's comments * referencing package version 0.0.0.4 of MlNetMklDeps that contains new names for the mkl library. * Correcting the error message. * renaming AdditionalLearners to HalLearners < - Hardware Accelerated Learners removign unsafe from the Hal csproj. removing the orphaned member section from the doc.xml * referencing package 0.0.0.5 and updating the name. * regenerating the CsharpApi and the eplist post merge * regenerate the CSharpApi and the eplists post merge. Fix the namespace post merge. * typo * one shall not space * spacing
1 parent 2d8c15b commit 20b448b

File tree

18 files changed

+91
-97
lines changed

18 files changed

+91
-97
lines changed

Microsoft.ML.sln

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.CodeAnalyzer.T
9999
EndProject
100100
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.ImageAnalytics", "src\Microsoft.ML.ImageAnalytics\Microsoft.ML.ImageAnalytics.csproj", "{00E38F77-1E61-4CDF-8F97-1417D4E85053}"
101101
EndProject
102+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.HalLearners", "src\Microsoft.ML.HalLearners\Microsoft.ML.HalLearners.csproj", "{A7222F41-1CF0-47D9-B80C-B4D77B027A61}"
103+
EndProject
102104
Global
103105
GlobalSection(SolutionConfigurationPlatforms) = preSolution
104106
Debug|Any CPU = Debug|Any CPU
@@ -339,6 +341,14 @@ Global
339341
{00E38F77-1E61-4CDF-8F97-1417D4E85053}.Release|Any CPU.Build.0 = Release|Any CPU
340342
{00E38F77-1E61-4CDF-8F97-1417D4E85053}.Release-Intrinsics|Any CPU.ActiveCfg = Release|Any CPU
341343
{00E38F77-1E61-4CDF-8F97-1417D4E85053}.Release-Intrinsics|Any CPU.Build.0 = Release|Any CPU
344+
{A7222F41-1CF0-47D9-B80C-B4D77B027A61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
345+
{A7222F41-1CF0-47D9-B80C-B4D77B027A61}.Debug|Any CPU.Build.0 = Debug|Any CPU
346+
{A7222F41-1CF0-47D9-B80C-B4D77B027A61}.Debug-Intrinsics|Any CPU.ActiveCfg = Debug|Any CPU
347+
{A7222F41-1CF0-47D9-B80C-B4D77B027A61}.Debug-Intrinsics|Any CPU.Build.0 = Debug|Any CPU
348+
{A7222F41-1CF0-47D9-B80C-B4D77B027A61}.Release|Any CPU.ActiveCfg = Release|Any CPU
349+
{A7222F41-1CF0-47D9-B80C-B4D77B027A61}.Release|Any CPU.Build.0 = Release|Any CPU
350+
{A7222F41-1CF0-47D9-B80C-B4D77B027A61}.Release-Intrinsics|Any CPU.ActiveCfg = Release|Any CPU
351+
{A7222F41-1CF0-47D9-B80C-B4D77B027A61}.Release-Intrinsics|Any CPU.Build.0 = Release|Any CPU
342352
EndGlobalSection
343353
GlobalSection(SolutionProperties) = preSolution
344354
HideSolutionNode = FALSE
@@ -378,6 +388,7 @@ Global
378388
{B4E55B2D-2A92-46E7-B72F-E76D6FD83440} = {7F13E156-3EBA-4021-84A5-CD56BA72F99E}
379389
{3E4ABF07-7970-4BE6-B45B-A13D3C397545} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
380390
{00E38F77-1E61-4CDF-8F97-1417D4E85053} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
391+
{A7222F41-1CF0-47D9-B80C-B4D77B027A61} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
381392
EndGlobalSection
382393
GlobalSection(ExtensibilityGlobals) = postSolution
383394
SolutionGuid = {41165AF1-35BB-4832-A189-73060F82B01D}

build/Dependencies.props

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
<SystemReflectionEmitLightweightPackageVersion>4.3.0</SystemReflectionEmitLightweightPackageVersion>
99
<PublishSymbolsPackageVersion>1.0.0-beta-62824-02</PublishSymbolsPackageVersion>
1010
<LightGBMPackageVersion>2.1.2.2</LightGBMPackageVersion>
11-
<MlNetMklDepsPackageVersion>0.0.0.4</MlNetMklDepsPackageVersion>
11+
<MlNetMklDepsPackageVersion>0.0.0.5</MlNetMklDepsPackageVersion>
1212
<SystemDrawingCommonPackageVersion>4.5.0</SystemDrawingCommonPackageVersion>
13-
>>>>>>> bdb742d... Image support (#528)
1413
</PropertyGroup>
1514
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="Pack">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<PackageDescription>ML.NET additional learners making use of hardware acceleration. They depend on the MlNetMklDeps NuGet package.</PackageDescription>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<ProjectReference Include="../Microsoft.ML/Microsoft.ML.nupkgproj" />
10+
<PackageReference Include="MlNetMklDeps" Version="$(MlNetMklDepsPackageVersion)" />
11+
</ItemGroup>
12+
13+
</Project>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project DefaultTargets="Pack">
2+
3+
<Import Project="Microsoft.ML.HalLearners.nupkgproj" />
4+
5+
</Project>

src/Microsoft.ML.Core/ComponentModel/ComponentCatalog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ private static bool ShouldSkipPath(string path)
343343
case "libvw.dll":
344344
case "matrixinterf.dll":
345345
case "Microsoft.ML.neuralnetworks.gpucuda.dll":
346-
case "Microsoft.ML.mklimports.dll":
346+
case "MklImports.dll":
347347
case "microsoft.research.controls.decisiontrees.dll":
348348
case "Microsoft.ML.neuralnetworks.sse.dll":
349349
case "neuraltreeevaluator.dll":
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<IncludeInPackage>Microsoft.ML.HalLearners</IncludeInPackage>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<ProjectReference Include="..\Microsoft.ML.Core\Microsoft.ML.Core.csproj" />
10+
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
11+
<ProjectReference Include="..\Microsoft.ML.StandardLearners\Microsoft.ML.StandardLearners.csproj" />
12+
<ProjectReference Include="..\Microsoft.ML\Microsoft.ML.csproj" />
13+
<PackageReference Include="MlNetMklDeps" Version="$(MlNetMklDepsPackageVersion)" />
14+
</ItemGroup>
15+
16+
</Project>

src/Microsoft.ML.StandardLearners/Standard/OlsLinearRegression.cs renamed to src/Microsoft.ML.HalLearners/OlsLinearRegression.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
using System;
88
using System.Collections.Generic;
99
using System.IO;
10-
using Microsoft.ML.Runtime.Internal.Internallearn;
1110
using Microsoft.ML.Runtime;
11+
using Microsoft.ML.Runtime.HalLearners;
12+
using Microsoft.ML.Runtime.Internal.Internallearn;
13+
using Microsoft.ML.Runtime.Internal.Utilities;
1214
using Microsoft.ML.Runtime.CommandLine;
1315
using Microsoft.ML.Runtime.Data;
1416
using Microsoft.ML.Runtime.EntryPoints;
1517
using Microsoft.ML.Runtime.Learners;
1618
using Microsoft.ML.Runtime.Model;
17-
using Microsoft.ML.Runtime.Internal.Utilities;
1819
using Microsoft.ML.Runtime.Training;
1920
using System.Runtime.InteropServices;
2021

@@ -30,7 +31,7 @@
3031

3132
[assembly: LoadableClass(typeof(void), typeof(OlsLinearRegressionTrainer), null, typeof(SignatureEntryPointModule), OlsLinearRegressionTrainer.LoadNameValue)]
3233

33-
namespace Microsoft.ML.Runtime.Learners
34+
namespace Microsoft.ML.Runtime.HalLearners
3435
{
3536
/// <include file='doc.xml' path='doc/members/member[@name="OLS"]/*' />
3637
public sealed class OlsLinearRegressionTrainer : TrainerBase<OlsLinearRegressionPredictor>
@@ -220,7 +221,7 @@ private OlsLinearRegressionPredictor TrainCore(IChannel ch, FloatLabelCursor.Fac
220221
catch (DllNotFoundException)
221222
{
222223
// REVIEW: Is there no better way?
223-
throw ch.ExceptNotSupp("The MKL library (Microsoft.ML.MklImports.dll) or one of its dependencies is missing.");
224+
throw ch.ExceptNotSupp("The MKL library (libMklImports) or one of its dependencies is missing.");
224225
}
225226
// Solve for beta in (LL')beta = X'y:
226227
Mkl.Pptrs(Mkl.Layout.RowMajor, Mkl.UpLo.Lo, m, 1, xtx, xty, 1);
@@ -329,7 +330,7 @@ private OlsLinearRegressionPredictor TrainCore(IChannel ch, FloatLabelCursor.Fac
329330

330331
internal static class Mkl
331332
{
332-
private const string DllName = "libMklImports";
333+
private const string DllName = "MklImports";
333334

334335
public enum Layout
335336
{
@@ -466,7 +467,7 @@ public static void Pptri(Layout layout, UpLo uplo, int n, Double[] ap)
466467
Desc = "Train an OLS regression model.",
467468
UserName = UserNameValue,
468469
ShortName = ShortName,
469-
XmlInclude = new[] { @"<include file='../Microsoft.ML.StandardLearners/Standard/doc.xml' path='doc/members/member[@name=""OLS""]/*' />" })]
470+
XmlInclude = new[] { @"<include file='../Microsoft.ML.HalLearners/doc.xml' path='doc/members/member[@name=""OLS""]/*' />" })]
470471
public static CommonOutputs.RegressionOutput TrainRegression(IHostEnvironment env, Arguments input)
471472
{
472473
Contracts.CheckValue(env, nameof(env));
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<doc>
3+
<members>
4+
5+
<member name="OLS">
6+
<summary>
7+
Train an OLS regression model.
8+
</summary>
9+
<remarks>
10+
<a href='https://en.wikipedia.org/wiki/Ordinary_least_squares'>Ordinary least squares (OLS)</a> is a parameterized regression method.
11+
It assumes that the conditional mean of the dependent variable follows a linear function of the dependent variables.
12+
The parameters of the regressor can be estimated by minimizing the squares of the difference between observed values and the predictions.
13+
</remarks>
14+
<example>
15+
<code language="csharp">
16+
new OrdinaryLeastSquaresRegressor
17+
{
18+
L2Weight = 0.1,
19+
PerParameterSignificance = false,
20+
NormalizeFeatures = Microsoft.ML.Models.NormalizeOption.Yes
21+
}
22+
</code>
23+
</example>
24+
</member>
25+
26+
</members>
27+
</doc>

src/Microsoft.ML.StandardLearners/Microsoft.ML.StandardLearners.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
@@ -11,7 +11,6 @@
1111
<ProjectReference Include="..\Microsoft.ML.CpuMath\Microsoft.ML.CpuMath.csproj" />
1212
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
1313
<ProjectReference Include="..\Microsoft.ML\Microsoft.ML.csproj" />
14-
<PackageReference Include="MlNetMklDeps" Version="0.0.0.4" />
1514
</ItemGroup>
1615

1716
</Project>

src/Microsoft.ML.StandardLearners/Standard/LinearPredictor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ public override void SaveAsIni(TextWriter writer, RoleMappedSchema schema, ICali
553553

554554
public abstract class RegressionPredictor : LinearPredictor
555555
{
556-
internal RegressionPredictor(IHostEnvironment env, string name, ref VBuffer<Float> weights, Float bias)
556+
protected RegressionPredictor(IHostEnvironment env, string name, ref VBuffer<Float> weights, Float bias)
557557
: base(env, name, ref weights, bias)
558558
{
559559
}

0 commit comments

Comments
 (0)