pyreal.RealApp.train_feature_contribution_llm#
- RealApp.train_feature_contribution_llm(transformer=None, x_train_orig=None, live=True, provide_examples=False, num_inputs=5, num_features=3)[source]#
Run the training process for the LLM model used to generate narrative feature contribution explanations.
- Parameters:
transformer (NarrativeTransformer) – NarrativeTransformer to train. If None, this RealApp object will save the training data for use in its produce_narrative functions
x_train_orig (DataFrame of shape (n_instances, n_features)) – Training set to take sample inputs from. If None, the training set must be provided to the explainer at initialization.
live (Boolean) – If True, run the training process through CLI input/outputs. If False, this function will generate a shell training file that will need to be filled out and added to the RealApp manually. Currently only live training is supported.
provide_examples (Boolean) – If True, generate a base example of explanations at each step. This may make the process faster, but will incur costs to your OpenAI API account.
num_inputs (int) – Number of inputs to request.
num_features (int) – Number of features to include per explanation. If None, all features will be included
- Returns:
- list of (explanation, narrative) pairs
The generated training data