TextClassificationTrainer Class

Definition

The IEstimator<TTransformer> for training a Deep Neural Network(DNN) to classify text.

public class TextClassificationTrainer : Microsoft.ML.TorchSharp.NasBert.NasBertTrainer<uint,long>
type TextClassificationTrainer = class
    inherit NasBertTrainer<uint32, int64>
Public Class TextClassificationTrainer
Inherits NasBertTrainer(Of UInteger, Long)
Inheritance

Remarks

To create this trainer, use TextClassification.

Input and Output Columns

The input label column data must be key type and the sentence columns must be of typeTextDataViewType.

This trainer outputs the following columns:

Output Column Name Column Type Description
PredictedLabel key type The predicted label's index. If its value is i, the actual label would be the i-th category in the key-valued input label type.
Score Vector ofSingle The scores of all classes.Higher value means higher probability to fall into the associated class. If the i-th element has the largest value, the predicted label index would be i.Note that i is zero-based index.

Trainer Characteristics

Machine learning task Multiclass classification
Is normalization required? No
Is caching required? No
Required NuGet in addition to Microsoft.ML Microsoft.ML.TorchSharp and libtorch-cpu or libtorch-cuda-11.3 or any of the OS specific variants.
Exportable to ONNX No

Training Algorithm Details

Trains a Deep Neural Network(DNN) by leveraging an existing pre-trained NAS-BERT roBERTa model for the purpose of classifying text.

Methods

Fit(IDataView) (Inherited from TorchSharpBaseTrainer<TLabelCol,TTargetsCol>)
GetOutputSchema(SchemaShape) (Inherited from NasBertTrainer<TLabelCol,TTargetsCol>)

Applies to