plexus.scores.OpenAIEmbeddingsClassifier module
- class plexus.scores.OpenAIEmbeddingsClassifier.OpenAIEmbeddingsClassifier(**parameters)
Bases:
Score
Initialize the Score instance with the given parameters.
Parameters
- **parametersdict
Arbitrary keyword arguments that are used to initialize the Parameters instance.
Raises
- ValidationError
If the provided parameters do not pass validation.
- class Parameters(*, scorecard_name: str | None = None, name: str | None = None, id: str | int | None = None, key: str | None = None, dependencies: List[dict] | None = None, data: dict | None = None, number_of_classes: int | None = None, label_score_name: str | None = None, label_field: str | None = None, embeddings_model: str, embeddings_model_trainable_layers: int = 3, maximum_tokens_per_window: int = 512, multiple_windows: bool = False, maximum_windows: int = 0, start_from_end: bool = False, number_of_epochs: int, batch_size: int, warmup_learning_rate: float, number_of_warmup_epochs: int, plateau_learning_rate: float, number_of_plateau_epochs: int, learning_rate_decay: float, early_stop_patience: int, l2_regularization_strength: float, dropout_rate: float)
Bases:
Parameters
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- batch_size: int
- dropout_rate: float
- early_stop_patience: int
- embeddings_model: str
- embeddings_model_trainable_layers: int
- l2_regularization_strength: float
- learning_rate_decay: float
- maximum_tokens_per_window: int
- maximum_windows: int
- model_config: ClassVar[ConfigDict] = {'protected_namespaces': ()}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- multiple_windows: bool
- number_of_epochs: int
- number_of_plateau_epochs: int
- number_of_warmup_epochs: int
- plateau_learning_rate: float
- start_from_end: bool
- warmup_learning_rate: float
- __init__(**parameters)
Initialize the Score instance with the given parameters.
Parameters
- **parametersdict
Arbitrary keyword arguments that are used to initialize the Parameters instance.
Raises
- ValidationError
If the provided parameters do not pass validation.
- evaluate_model()
Evaluate the model on the validation data.
Returns
- dict
Dictionary containing evaluation metrics.
- predict(context, model_input)
Make predictions on the input data.
Parameters
- contextAny
Context for the prediction (e.g., MLflow context)
- model_inputScore.Input
The input data for making predictions.
Returns
- Union[Score.Result, List[Score.Result]]
Either a single Score.Result or a list of Score.Results
- predict_validation()
Predict on the validation set.
This method should be implemented by subclasses to provide the prediction logic on the validation set.
- process_data(data=None)
Handle any pre-processing of the training data, including the training/validation splits.