Method CreateTrainingObject
- Namespace
- LMKit.TextAnalysis
- Assembly
- LM-Kit.NET.dll
CreateTrainingObject(TrainingDataset, int, bool, int?)
Creates a training object for fine-tuning a sentiment analysis model using a specified dataset.
public LoraFinetuning CreateTrainingObject(SentimentAnalysis.TrainingDataset dataset, int maxSamples = 2147483647, bool shuffle = false, int? seed = null)
Parameters
dataset
SentimentAnalysis.TrainingDatasetThe dataset to be used for training.
maxSamples
intThe maximum number of samples to use from the dataset. Default is int.MaxValue.
shuffle
boolIndicates whether to shuffle the dataset before selecting samples. Default is false.
seed
int?An optional seed for the random number generator used when shuffling. If
null
, the shuffle operation will not be seeded.
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.
CreateTrainingObject(IList<(string, SentimentCategory)>, int)
Creates an object for fine-tuning a sentiment analysis model using the provided training data.
public LoraFinetuning CreateTrainingObject(IList<(string, SentimentAnalysis.SentimentCategory)> trainingData, int maxSamples = 2147483647)
Parameters
trainingData
IList<(string, SentimentAnalysis.SentimentCategory)>A list of tuples where each tuple contains a text (string) and its corresponding sentiment category (SentimentCategory).
The text represents the input data, and the sentiment category represents the expected output.maxSamples
intThe maximum number of training samples to use. The default value is int.MaxValue. 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 sentiment analysis 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 sentiment category.- InvalidModelException
Thrown if fine-tuning is not supported for Embedding classification mode.