refactor(trainer): use correct schema, though it shouldn't matter

This commit is contained in:
Anna 2020-12-28 22:00:33 -05:00
parent 908133bdf8
commit 96ef48f9db
Signed by: anna
GPG Key ID: 0B391D8F06FCD9E0
2 changed files with 3 additions and 2 deletions

View File

@ -95,6 +95,7 @@ namespace NoSoliciting.Interface {
if (this.Category != null && weights.TryGetValue(this.Category, out var weight)) { if (this.Category != null && weights.TryGetValue(this.Category, out var weight)) {
output.Weight = weight; output.Weight = weight;
} }
output.PartyFinder = this.Channel == 0; output.PartyFinder = this.Channel == 0;
output.Shout = this.Channel == 11 || this.Channel == 30; output.Shout = this.Channel == 11 || this.Channel == 30;
output.ContainsWard = this.Message.ContainsIgnoreCase("ward") || WardRegex.IsMatch(this.Message); output.ContainsWard = this.Message.ContainsIgnoreCase("ward") || WardRegex.IsMatch(this.Message);

View File

@ -60,7 +60,7 @@ namespace NoSoliciting.Trainer {
ctx.ComponentCatalog.RegisterAssembly(typeof(Data).Assembly); ctx.ComponentCatalog.RegisterAssembly(typeof(Data).Assembly);
var pipeline = ctx.Transforms.Conversion.MapValueToKey("Label", nameof(Data.Category)) var pipeline = ctx.Transforms.Conversion.MapValueToKey("Label", nameof(Data.Category))
.Append(ctx.Transforms.CustomMapping((Action<Data, Data.Computed>) compute.Compute, "Compute")) .Append(ctx.Transforms.CustomMapping(compute.GetMapping(), "Compute"))
.Append(ctx.Transforms.Text.NormalizeText("MsgNormal", nameof(Data.Message), keepPunctuations: false)) .Append(ctx.Transforms.Text.NormalizeText("MsgNormal", nameof(Data.Message), keepPunctuations: false))
.Append(ctx.Transforms.Text.TokenizeIntoWords("MsgTokens", "MsgNormal")) .Append(ctx.Transforms.Text.TokenizeIntoWords("MsgTokens", "MsgNormal"))
// .Append(ctx.Transforms.Text.RemoveStopWords("MsgNoStop", "MsgTokens", // .Append(ctx.Transforms.Text.RemoveStopWords("MsgNoStop", "MsgTokens",
@ -95,7 +95,7 @@ namespace NoSoliciting.Trainer {
var model = pipeline.Fit(train); var model = pipeline.Fit(train);
ctx.Model.Save(model, df.Schema, @"../../../model.zip"); ctx.Model.Save(model, train.Schema, @"../../../model.zip");
var testPredictions = model.Transform(ttd.TestSet); var testPredictions = model.Transform(ttd.TestSet);
var eval = ctx.MulticlassClassification.Evaluate(testPredictions); var eval = ctx.MulticlassClassification.Evaluate(testPredictions);