Skip to content

add automl experiment api && cfo tuner - #6140

Merged
michaelgsharp merged 28 commits into
dotnet:mainfrom
LittleLittleCloud:u/xiaoyun/addAutoMLExperiment
Apr 21, 2022
Merged

add automl experiment api && cfo tuner#6140
michaelgsharp merged 28 commits into
dotnet:mainfrom
LittleLittleCloud:u/xiaoyun/addAutoMLExperiment

Conversation

@LittleLittleCloud

@LittleLittleCloud LittleLittleCloud commented Mar 28, 2022

Copy link
Copy Markdown
Member

We are excited to review your PR.

So we can do the best job, please check:

  • There's a descriptive title that will make sense to other developers some time from now.
  • There's associated issues. All PR's should have issue(s) associated - unless a trivial self-evident change such as fixing a typo. You can use the format Fixes #nnnn in your description to cause GitHub to automatically close the issue(s) when your PR is merged.
  • Your change description explains what the change does, why you chose your approach, and anything else that reviewers should know.
  • You have included any necessary tests in the same PR.

#6118

This PR implements AutoML Experiment API proposed in #6118. It also includes CFO tuner from model builder, which provides better searching algorithm.

In implementation, AutoMLExperiment class is essentially a service collection for ITuner, IRunner and other components which can be replaced or expanded easily.

@LittleLittleCloud

LittleLittleCloud commented Apr 4, 2022

Copy link
Copy Markdown
Member Author

/azp run


In reply to: 1087834657


In reply to: 1087834657

@azure-pipelines

azure-pipelines Bot commented Apr 4, 2022

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

In reply to: 1087834863


In reply to: 1087834863

@LittleLittleCloud LittleLittleCloud added the AutoML.NET Automating various steps of the machine learning process label Apr 4, 2022
@codecov

codecov Bot commented Apr 4, 2022

Copy link
Copy Markdown

Codecov Report

Merging #6140 (c1fc20b) into main (36e4524) will decrease coverage by 0.03%.
The diff coverage is 94.21%.

@@            Coverage Diff             @@
##             main    #6140      +/-   ##
==========================================
- Coverage   68.33%   68.29%   -0.04%     
==========================================
  Files        1097     1098       +1     
  Lines      241915   242080     +165     
  Branches    25157    25166       +9     
==========================================
+ Hits       165317   165333      +16     
- Misses      70049    70177     +128     
- Partials     6549     6570      +21     
Flag Coverage Δ
Debug 68.29% <94.21%> (-0.04%) ⬇️
production 62.75% <0.00%> (-0.08%) ⬇️
test 88.82% <96.44%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Microsoft.ML.SearchSpace/Tuner/RandomTuner.cs 0.00% <0.00%> (ø)
test/Microsoft.ML.AutoML.Tests/TunerTests.cs 96.44% <96.44%> (ø)
...osoft.ML.KMeansClustering/KMeansPlusPlusTrainer.cs 83.60% <0.00%> (-7.16%) ⬇️
src/Microsoft.ML.FastTree/Training/StepSearch.cs 57.42% <0.00%> (-4.96%) ⬇️
src/Microsoft.ML.Data/Training/TrainerUtils.cs 65.86% <0.00%> (-3.82%) ⬇️
...crosoft.ML.StandardTrainers/Standard/SdcaBinary.cs 85.06% <0.00%> (-3.08%) ⬇️
test/Microsoft.ML.AutoML.Tests/AutoFitTests.cs 87.07% <0.00%> (-1.97%) ⬇️
src/Microsoft.ML.Sweeper/AsyncSweeper.cs 71.42% <0.00%> (-1.37%) ⬇️
...oft.ML.StandardTrainers/Standard/SdcaMulticlass.cs 91.12% <0.00%> (-1.03%) ⬇️
...soft.ML.Data/DataLoadSave/Text/TextLoaderCursor.cs 89.77% <0.00%> (-0.64%) ⬇️
... and 2 more

Comment thread src/Microsoft.ML.AutoML/AutoMLExperiment/AutoMLExperiment.cs Outdated
Comment thread src/Microsoft.ML.AutoML/AutoMLExperiment/AutoMLExperiment.cs
Comment thread src/Microsoft.ML.AutoML/AutoMLExperiment/AutoMLExperiment.cs Outdated
Comment thread src/Microsoft.ML.AutoML/AutoMLExperiment/AutoMLExperiment.cs Outdated
Comment thread src/Microsoft.ML.AutoML/AutoMLExperiment/IDatasetSettings.cs
Comment thread src/Microsoft.ML.AutoML/AutoMLExperiment/TrialResult.cs Outdated
TrialResult Run(TrialSettings settings);
}

internal class BinaryClassificationCVRunner : ITrialRunner

@michaelgsharp michaelgsharp Apr 5, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BinaryClassificationCVRunner : ITrialRunner

I feel like these classes should be refactored. It seems like 90% of the code here is the same, couldn't you change ITrialRunner into an abstract base class that does all the shared work and the actual implementations only have to do the remaining small amount? #Resolved

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hardly think so. Although 90% of the code looks the same, actually it's not. The code for training a model, evaluating a model and creating training result is different for each scenario and each dataset setting, so the benefits of pulling out all trial runners's shared code into a base class is small considering that the training/evaluation/creating result code still need to be somewhere. In this case I'd prefer to not having a common class for those trial runners in this case.

#nullable enable
namespace Microsoft.ML.AutoML
{
internal interface ITrialRunnerFactory

@michaelgsharp michaelgsharp Apr 5, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internal interface ITrialRunnerFactory

Is this used anywhere else? Or just here? #Resolved

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just here for now, But I plan to add another class which would also implement this interface. The code will look like this

internal class CustomTrialRunnerFactory: ITrialRunnerFactory
{
    public class CustomTrialRunnerFactory(ITrialRunner instance)
    {
        this.instance = instance;
    }

    public ITrialRunner? CreateTrialRunner(TrialSettings settings)
    {
        return this.instance;
    }
}

The purpose of this class is to provide the ability for users to pass their own ITrialRunner into AutoMLExperiment. Meanwhile this pattern will also be used to increase extensibility for other components in AutoMLExperiment as well.

Comment thread src/Microsoft.ML.AutoML/AutoMLExperiment/TunerFactory.cs Outdated
Comment thread src/Microsoft.ML.AutoML/Microsoft.ML.AutoML.csproj Outdated
Comment thread src/Microsoft.ML.AutoML/AutoMLExperiment/AutoMLExperiment.cs
Comment thread src/Microsoft.ML.AutoML/Tuner/Flow2.cs Outdated

namespace Microsoft.ML.AutoML
{
internal class Flow2

@michaelgsharp michaelgsharp Apr 5, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flow2

I know this isn't a public class, but some comments would be useful here to better understand what this class does. Just the name doesn't tell much, and knowing more will help with supporting it in the future. #Resolved

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an implementation of an algo in this paper

image

I can put a url in code to point to that paper, would that be enough


namespace Microsoft.ML.AutoML
{
public class ArrayMath

@michaelgsharp michaelgsharp Apr 5, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ArrayMath

Are the things in here used a lot? We have some efficient array math stuff already in ML.NET you could use if this needs to be efficient. #Resolved

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, they are more used as a helper method for array-like numeric structure and efficiency is not the top-priority here. Beside I just find out that most of these methods are not used anywhere so just did a few clean up as well.

Comment thread src/Microsoft.ML.SearchSpace/Tuner/RandomTuner.cs

namespace Microsoft.ML.AutoML.Test
{
public class TunerTests : BaseTestClass

@michaelgsharp michaelgsharp Apr 5, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TunerTests

You are missing tests for the other tuners, the array math, etc. Those need to be added. #Resolved

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests for cfo tuner is migrated from model builder repo and I will put more tests for other tuners and entire automl experiment soon in a separate PR.

@azure-pipelines

azure-pipelines Bot commented Apr 19, 2022

Copy link
Copy Markdown
Command 'run

In' is not supported by Azure Pipelines.



Supported commands

  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

In reply to: 1103144497

@azure-pipelines

Copy link
Copy Markdown
Command 'run

In' is not supported by Azure Pipelines.



Supported commands

  • help:
    • Get descriptions, examples and documentation about supported commands
    • Example: help "command_name"
  • list:
    • List all pipelines for this repository using a comment.
    • Example: "list"
  • run:
    • Run all pipelines or specific pipelines for this repository using a comment. Use this command by itself to trigger all related pipelines, or specify specific pipelines to run.
    • Example: "run" or "run pipeline_name, pipeline_name, pipeline_name"
  • where:
    • Report back the Azure DevOps orgs that are related to this repository and org
    • Example: "where"

See additional documentation.

@LittleLittleCloud

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@michaelgsharp
michaelgsharp merged commit c0e1645 into dotnet:main Apr 21, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

AutoML.NET Automating various steps of the machine learning process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants