TorchSharpCatalog.TextClassification Method

Definition

Overloads

TextClassification(MulticlassClassificationCatalog+MulticlassClassificationTrainers, TextClassificationTrainer+TextClassificationOptions)

Fine tune a NAS-BERT model for NLP classification. The limit for any sentence is 512 tokens. Each word typically will map to a single token, and we automatically add 2 specical tokens (a start token and a separator token) so in general this limit will be 510 words for all sentences.

TextClassification(MulticlassClassificationCatalog+MulticlassClassificationTrainers, String, String, String, String, String, Int32, Int32, BertArchitecture, IDataView)

Fine tune a NAS-BERT model for NLP classification. The limit for any sentence is 512 tokens. Each word typically will map to a single token, and we automatically add 2 specical tokens (a start token and a separator token) so in general this limit will be 510 words for all sentences.

TextClassification(MulticlassClassificationCatalog+MulticlassClassificationTrainers, TextClassificationTrainer+TextClassificationOptions)

Fine tune a NAS-BERT model for NLP classification. The limit for any sentence is 512 tokens. Each word typically will map to a single token, and we automatically add 2 specical tokens (a start token and a separator token) so in general this limit will be 510 words for all sentences.

public static Microsoft.ML.TorchSharp.NasBert.TextClassificationTrainer TextClassification (this Microsoft.ML.MulticlassClassificationCatalog.MulticlassClassificationTrainers catalog, Microsoft.ML.TorchSharp.NasBert.TextClassificationTrainer.TextClassificationOptions options);
static member TextClassification : Microsoft.ML.MulticlassClassificationCatalog.MulticlassClassificationTrainers * Microsoft.ML.TorchSharp.NasBert.TextClassificationTrainer.TextClassificationOptions -> Microsoft.ML.TorchSharp.NasBert.TextClassificationTrainer
<Extension()>
Public Function TextClassification (catalog As MulticlassClassificationCatalog.MulticlassClassificationTrainers, options As TextClassificationTrainer.TextClassificationOptions) As TextClassificationTrainer

Parameters

Returns

Applies to

TextClassification(MulticlassClassificationCatalog+MulticlassClassificationTrainers, String, String, String, String, String, Int32, Int32, BertArchitecture, IDataView)

Fine tune a NAS-BERT model for NLP classification. The limit for any sentence is 512 tokens. Each word typically will map to a single token, and we automatically add 2 specical tokens (a start token and a separator token) so in general this limit will be 510 words for all sentences.

public static Microsoft.ML.TorchSharp.NasBert.TextClassificationTrainer TextClassification (this Microsoft.ML.MulticlassClassificationCatalog.MulticlassClassificationTrainers catalog, string labelColumnName = "Label", string scoreColumnName = "Score", string outputColumnName = "PredictedLabel", string sentence1ColumnName = "Sentence1", string sentence2ColumnName = default, int batchSize = 32, int maxEpochs = 10, Microsoft.ML.TorchSharp.NasBert.BertArchitecture architecture = Microsoft.ML.TorchSharp.NasBert.BertArchitecture.Roberta, Microsoft.ML.IDataView validationSet = default);
static member TextClassification : Microsoft.ML.MulticlassClassificationCatalog.MulticlassClassificationTrainers * string * string * string * string * string * int * int * Microsoft.ML.TorchSharp.NasBert.BertArchitecture * Microsoft.ML.IDataView -> Microsoft.ML.TorchSharp.NasBert.TextClassificationTrainer
<Extension()>
Public Function TextClassification (catalog As MulticlassClassificationCatalog.MulticlassClassificationTrainers, Optional labelColumnName As String = "Label", Optional scoreColumnName As String = "Score", Optional outputColumnName As String = "PredictedLabel", Optional sentence1ColumnName As String = "Sentence1", Optional sentence2ColumnName As String = Nothing, Optional batchSize As Integer = 32, Optional maxEpochs As Integer = 10, Optional architecture As BertArchitecture = Microsoft.ML.TorchSharp.NasBert.BertArchitecture.Roberta, Optional validationSet As IDataView = Nothing) As TextClassificationTrainer

Parameters

labelColumnName
String

Name of the label column. Column should be a key type.

scoreColumnName
String

Name of the score column.

outputColumnName
String

Name of the output column. It will be a key type. It is the predicted label.

sentence1ColumnName
String

Name of the column for the first sentence.

sentence2ColumnName
String

Name of the column for the second sentence. Only required if your NLP classification requires sentence pairs.

batchSize
Int32

Number of rows in the batch.

maxEpochs
Int32

Maximum number of times to loop through your training set.

architecture
BertArchitecture

Architecture for the model. Defaults to Roberta.

validationSet
IDataView

The validation set used while training to improve model quality.

Returns

Applies to