-
Notifications
You must be signed in to change notification settings - Fork 1.9k
PipelineSweeperMacro for Multi-Class Classification #539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
41f8598
b7653de
0ccfbab
46af33f
d7e8402
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,6 +362,73 @@ public void EntryPointPipelineSweepRoles() | |
Assert.True(rows.All(r => r.TrainingMetricValue > 0.1)); | ||
} | ||
|
||
[Fact] | ||
[TestCategory("EntryPoints")] | ||
public void EntryPointPipelineSweepMultiClass() | ||
{ | ||
// Get datasets | ||
var pathData = GetDataPath("adult.train"); | ||
var pathDataTest = GetDataPath("adult.test"); | ||
const int numOfSampleRows = 100; | ||
const string schema = | ||
"sep=, col=age:R4:0 col=workclass:TX:1 col=fnlwgt:R4:2 col=education:TX:3 col=education_num:R4:4 col=marital_status:TX:5 col=occupation:TX:6 " + | ||
"col=relationship:TX:7 col=ethnicity:TX:8 col=sex:TX:9 col=Features:R4:10-12 col=native_country:TX:13 col=IsOver50K_:R4:14 header=+"; | ||
var inputFileTrain = new SimpleFileHandle(Env, pathData, false, false); | ||
#pragma warning disable 0618 | ||
var datasetTrain = ImportTextData.ImportText(Env, | ||
new ImportTextData.Input { InputFile = inputFileTrain, CustomSchema = schema }).Data.Take(numOfSampleRows); | ||
var inputFileTest = new SimpleFileHandle(Env, pathDataTest, false, false); | ||
var datasetTest = ImportTextData.ImportText(Env, | ||
new ImportTextData.Input { InputFile = inputFileTest, CustomSchema = schema }).Data.Take(numOfSampleRows); | ||
#pragma warning restore 0618 | ||
|
||
// Define entrypoint graph | ||
string inputGraph = @" | ||
{ | ||
'Nodes': [ | ||
{ | ||
'Name': 'Models.PipelineSweeper', | ||
'Inputs': { | ||
'TrainingData': '$TrainingData', | ||
'TestingData': '$TestingData', | ||
'LabelColumns': ['IsOver50K_'], | ||
'WeightColumns': ['education_num'], | ||
'NameColumns': ['education'], | ||
'TextFeatureColumns': ['workclass', 'marital_status', 'occupation'], | ||
'StateArguments': { | ||
'Name': 'AutoMlState', | ||
'Settings': { | ||
'Metric': 'Accuracy(micro-avg)', | ||
'Engine': { | ||
'Name': 'Defaults' | ||
}, | ||
'TerminatorArgs': { | ||
'Name': 'IterationLimited', | ||
'Settings': { | ||
'FinalHistoryLength': 2 | ||
} | ||
}, | ||
'TrainerKind': 'SignatureMultiClassClassifierTrainer', | ||
} | ||
}, | ||
'BatchSize': 1 | ||
}, | ||
'Outputs': { | ||
'State': '$StateOut', | ||
'Results': '$ResultsOut' | ||
} | ||
}, | ||
] | ||
}"; | ||
|
||
JObject graphJson = JObject.Parse(inputGraph); | ||
var catalog = ModuleCatalog.CreateInstance(Env); | ||
var runner = new GraphRunner(Env, catalog, graphJson[FieldNames.Nodes] as JArray); | ||
runner.SetInput("TrainingData", datasetTrain); | ||
runner.SetInput("TestingData", datasetTest); | ||
runner.RunAll(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
do you think the test should have a check on the results, make sure they are the same all the time, at least. #Resolved There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
[Fact] | ||
public void TestRocketPipelineEngine() | ||
{ | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disables warning generated because of using ImportText (obsolete) instead of Textloader.
Perhaps in a future PR, we can update all the unit tests to use TextLoader. I can create a separate bug to track that.
In reply to: 202746784 [](ancestors = 202746784)