-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sweepable estimator to NER (#6965)
- Loading branch information
Showing
5 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/Microsoft.ML.AutoML/CodeGen/named_entity_recognition_search_space.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"$schema": "./search-space-schema.json#", | ||
"name": "named_entity_recognition_option", | ||
"search_space": [ | ||
{ | ||
"name": "PredictionColumnName", | ||
"type": "string", | ||
"default": "predictedLabel" | ||
}, | ||
{ | ||
"name": "LabelColumnName", | ||
"type": "string", | ||
"default": "Label" | ||
}, | ||
{ | ||
"name": "Sentence1ColumnName", | ||
"type": "string", | ||
"default": "Sentence" | ||
}, | ||
{ | ||
"name": "BatchSize", | ||
"type": "integer", | ||
"default": 32 | ||
}, | ||
{ | ||
"name": "MaxEpochs", | ||
"type": "integer", | ||
"default": 10 | ||
}, | ||
{ | ||
"name": "Architecture", | ||
"type": "bertArchitecture", | ||
"default": "BertArchitecture.Roberta" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/Microsoft.ML.AutoML/SweepableEstimator/Estimators/NamedEntityRecognitionMulti.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.ML.TorchSharp; | ||
using Microsoft.ML.TorchSharp.NasBert; | ||
|
||
namespace Microsoft.ML.AutoML.CodeGen | ||
{ | ||
internal partial class NamedEntityRecognitionMulti | ||
{ | ||
public override IEstimator<ITransformer> BuildFromOption(MLContext context, NamedEntityRecognitionOption param) | ||
{ | ||
return context.MulticlassClassification.Trainers.NamedEntityRecognition( | ||
labelColumnName: param.LabelColumnName, | ||
outputColumnName: param.PredictionColumnName, | ||
sentence1ColumnName: param.Sentence1ColumnName, | ||
batchSize: param.BatchSize, | ||
maxEpochs: param.MaxEpochs, | ||
architecture: BertArchitecture.Roberta); | ||
} | ||
} | ||
} |