Method CreateTrainingObject
- Namespace
- LMKit.TextAnalysis
- Assembly
- LM-Kit.NET.dll
CreateTrainingObject(IList<(string, EmotionCategory)>, int)
Creates an object for fine-tuning an emotion detection model using the provided training data.
public LoraFinetuning CreateTrainingObject(IList<(string, EmotionDetection.EmotionCategory)> trainingData, int maxSamples = 1000)
Parameters
trainingData
IList<(string, EmotionDetection.EmotionCategory)>A list of tuples where each tuple contains a text (string) and its corresponding emotion category (EmotionDetection.EmotionCategory).
The text represents the input data, and the emotion category represents the expected output.maxSamples
intThe maximum number of training samples to use. The default value is 1000. If the number of samples in
trainingData
exceeds this value, only the firstmaxSamples
samples will be used.
Returns
- LoraFinetuning
A LoraFinetuning object configured for fine-tuning the emotion detection model with the provided training data.
Exceptions
- ArgumentNullException
Thrown if the
trainingData
argument is null.- ArgumentException
Thrown if the
trainingData
list is empty, or if any entry in the list is associated with an undefined emotion category.- InvalidModelException
Thrown if fine-tuning is not supported for Embedding classification mode.
CreateTrainingObject(TrainingDataset, int, bool, int?, bool)
Creates a training object for fine-tuning an emotion detection model using a specified dataset.
public LoraFinetuning CreateTrainingObject(EmotionDetection.TrainingDataset dataset, int maxSamples = 1000, bool shuffle = true, int? seed = null, bool neutralSupport = true)
Parameters
dataset
EmotionDetection.TrainingDatasetThe dataset to be used for training.
maxSamples
intThe maximum number of samples to use from the dataset. Default is 1000.
shuffle
boolIndicates whether to shuffle the dataset before selecting samples. Default is true.
seed
int?An optional seed for the random number generator used when shuffling. If
null
, the shuffle operation will not be seeded.neutralSupport
boolSpecifies whether support for neutral samples should be included. The default is true.
Returns
- LoraFinetuning
A LoraFinetuning object configured with the training data.
Exceptions
- ArgumentException
Thrown if the dataset is not recognized.
- InvalidModelException
Thrown if fine-tuning is not supported for Embedding classification mode.