Skip to content

I want to convert a text classification sample from ML 0.4 to ML 0.11 and cannot find equivalent code for calling Transforms.Text.FeaturizeText #2994

Closed
@bpietroiu

Description

@bpietroiu

System information

  • OS version/distro: Win10
  • .NET Version (eg., dotnet --info): 4.7.1

Issue

  • What did you do?
    I want to convert a text classification sample from ML 0.4 to ML 0.11

  • What happened?
    I cannot find equivalent parameters for TextFeaturizer, there are no CharFeatureExtractor and WordFeatureExtractor NgramExtractors in 0.11 Transforms.Text.FeaturizeText arguments

  • What did you expect?

Source code / logs

0.4 version

                new TextFeaturizer("Features", "TextColumn")
                {
                    KeepDiacritics = false,
                    KeepPunctuations = false,
                    OutputTokens = true,
                    Language = TextFeaturizingEstimatorLanguage.English,
                    VectorNormalizer = TextFeaturizingEstimatorTextNormKind.L2,
                    TextCase = TextNormalizingEstimatorCaseNormalizationMode.Lower,
                    CharFeatureExtractor = new NGramNgramExtractor() {NgramLength = 3, AllLengths = false},
                    WordFeatureExtractor = new NGramNgramExtractor() {NgramLength = 3, AllLengths = true}
                }, 

0.11 version

var transform mlContext.Transforms.Text.FeaturizeText(outputColumnName: "TextColumnFeaturized",
                        options: new TextFeaturizingEstimator.Options()
                        {
                            KeepDiacritics = false,
                            KeepPunctuations = false,
                            OutputTokens = true,
                            TextLanguage = TextFeaturizingEstimator.Language.English,
                            VectorNormalizer = TextFeaturizingEstimator.TextNormKind.L2,
                            TextCase = TextNormalizingEstimator.CaseNormalizationMode.Lower,
                            UseWordExtractor = true,
                            UseCharExtractor = true
                        }, inputColumnNames: new []{ "TextColumn" });

I see that CharFeatureExtractor and WordFeatureExtractor parameters are gone, and instead two we have boolean properties, UseWordExtractor and UseCharExtractor.

The models trained using the above code and the same train data perform differently, namly the 0.4 version has a better classsification performace.

How do I configure a pipeline to achieve the same results as in 0.4 version?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions