in sdk/dotnet/AzureML-Samples-CSharp/Jobs/AutomlJob/AutoMLJobOperations.cs [21:114]
public static async Task<MachineLearningJobResource> SubmitAutoMLTextNerAsync(
ResourceGroupResource resourceGroup,
string workspaceName,
string id,
string experimentName,
string environmentId,
string computeId)
{
Console.WriteLine("Creating an AutoML TextNer...");
MachineLearningWorkspaceResource ws = await resourceGroup.GetMachineLearningWorkspaces().GetAsync(workspaceName);
var trainData = new MLTableJobInput(new Uri("https://raw.githubusercontent.com/Azure/azureml-examples/main/cli/jobs/automl-standalone-jobs/cli-automl-text-ner-conll/training-mltable-folder"))
{
Mode = InputDeliveryMode.ReadOnlyMount,
Description = "Train data",
};
//var trainData1 = new MLTableJobInput(new Uri("azureml:mydata01:1"))
//{
// Mode = InputDeliveryMode.ReadOnlyMount,
// Description = "Train data",
//};
var validationData = new MLTableJobInput(new Uri("https://raw.githubusercontent.com/Azure/azureml-examples/main/cli/jobs/automl-standalone-jobs/cli-automl-text-ner-conll/validation-mltable-folder"))
{
Mode = InputDeliveryMode.ReadOnlyMount,
Description = "Validation data",
};
var trainingDataSettings = new TrainingDataSettings(trainData);
AutoMLVertical taskDetails = new TextNer
{
LogVerbosity = LogVerbosity.Debug,
DataSettings = new NlpVerticalDataSettings("label", trainingDataSettings)
{
// The combined validation and test sizes must be between 0 and 0.99 inclusive when specified. Test split is not supported for task type: text-ner.
ValidationData = new NlpVerticalValidationDataSettings()
{
Data = validationData,
// Validation size must be between 0.01 and 0.99 inclusive when specified. Test size must be between 0 and 0.99 inclusive when specified. Test split is not supported for task type: text-ner
ValidationDataSize = 0.20,
},
// Test split is not supported for task type: text-ner.
//TestData = new TestDataSettings()
//{
// Data = testData,
// // Test size must be between 0 and 0.99 inclusive when specified. Test split is not supported for task type: text-ner
// TestDataSize = 0.38,
//},
},
FeaturizationDatasetLanguage = "US",
LimitSettings = new NlpVerticalLimitSettings
{
MaxTrials = 2,
Timeout = TimeSpan.FromMinutes(1800),
MaxConcurrentTrials = 2
},
};
var autoMLJob = new AutoMLJob(taskDetails)
{
ExperimentName = experimentName,
DisplayName = "AutoMLJobTextNer-" + Guid.NewGuid().ToString("n").Substring(0, 6),
EnvironmentId = environmentId,
IsArchived = false,
ComputeId = computeId,
Resources = new ResourceConfiguration
{
InstanceCount = 2,
},
Properties = new Dictionary<string, string>
{
{ "property-name", "property-value" },
},
Tags = new Dictionary<string, string>
{
{ "tag-name", "tag-value" },
},
//Environment variables included in the job.
EnvironmentVariables = new Dictionary<string, string>()
{
{ "env-var", "env-var-value" }
},
Description = "This is a description of test AutoMLJob for TextNer",
};
MachineLearningJobData data = new MachineLearningJobData(autoMLJob);
ArmOperation<MachineLearningJobResource> jobOperation = await ws.GetMachineLearningJobs().CreateOrUpdateAsync(WaitUntil.Completed, id, data);
MachineLearningJobResource jobResource = jobOperation.Value;
Console.WriteLine($"JobCreateOrUpdateOperation {jobResource.Data.Id} created.");
return jobResource;
}