Guest User

Untitled

a guest
Jan 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. // Create data process pipeline
  2. // First we have to change label value into ML.NET KeyType
  3. var dataProcessPipeline = context.Transforms.Conversion.MapValueToKey("Label")
  4. // Then, we have to normalize text
  5. .Append(context.Transforms.Text.NormalizeText("Sentence", "NormalizedSentence"))
  6. // Featurize the given text with n-grams
  7. .Append(context.Transforms.Text.FeaturizeText("NormalizedSentence", "Features"))
  8. // Give the naive bayes algorithm
  9. .Append(context.MulticlassClassification.Trainers.NaiveBayes())
  10. // Convert back the label value to it's origin
  11. .Append(context.Transforms.Conversion.MapKeyToValue("PredictedLabel"));
Add Comment
Please, Sign In to add comment