Support Vector Machines (SVM)
Support Vector Machine (SVM) model implementations.
- class openadmet.models.architecture.svm.SVMClassifierModel(*, C: float = 1.0, kernel: str = 'rbf', degree: int = 3, gamma: str = 'scale', coef0: float = 0.0, shrinking: bool = True, probability: bool = False, tol: float = 0.001, cache_size: int = 200, class_weight: dict | None = None, verbose: bool = False, max_iter: int = -1, decision_function_shape: str = 'ovr', break_ties: bool = False, random_state: int | None = None)[source]
Bases:
SVMModelBaseSVM classification model.
Common parameters for SVM models can be found at: https://scikit-learn.org/stable/modules/svm.html Common parameters that you might want to set include: - C: Regularization parameter - kernel: Specifies the kernel type to be used in the algorithm - degree: Degree of the polynomial kernel function (if using ‘poly’ kernel) - learning_rate: Step size shrinkage used in update to prevent overfitting - objective: Specify the learning task and corresponding objective function - booster: Specify which booster to use, options are gbtree, gblinear or dart - tree_method: Specify the tree construction algorithm used in XGBoost
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Args:
self: The BaseModel instance. context: The context.
- predict_proba(X: ndarray) ndarray[source]
Predict using the model, returning probabilities for each class.
- Parameters:
X (np.ndarray) – Data to predict on
- Returns:
Probabilities for each class from the model
- Return type:
np.ndarray
- class openadmet.models.architecture.svm.SVMModelBase[source]
Bases:
PickleableModelBaseBase class for SVM models.
- build()[source]
Prepare the model.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None
This function is meant to behave like a BaseModel method to initialize private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Args:
self: The BaseModel instance. context: The context.
- predict(X: ndarray, **kwargs) ndarray[source]
Predict using the model.
- Parameters:
X (np.ndarray) – Data to predict on
**kwargs – Additional keyword arguments for the predict method.
- Returns:
Predictions from the model
- Return type:
np.ndarray
- train(X: ndarray, y: ndarray)[source]
Train the model.
- Parameters:
X (np.ndarray) – Training data features
y (np.ndarray) – Training data labels
- class openadmet.models.architecture.svm.SVMRegressorModel(*, kernel: str = 'rbf', degree: int = 3, gamma: str = 'scale', coef0: float = 0.0, tol: float = 0.001, C: float = 1.0, epsilon: float = 0.1, shrinking: bool = True, cache_size: int = 200, verbose: bool = False, max_iter: int = -1)[source]
Bases:
SVMModelBaseSVM regression model.
Common parameters for SVM models can be found at: https://scikit-learn.org/stable/modules/svm.html
Common parameters that you might want to set include: - C: Regularization parameter - kernel: Specifies the kernel type to be used in the algorithm - degree: Degree of the polynomial kernel function (if using ‘poly’ kernel) - learning_rate: Step size shrinkage used in update to prevent overfitting - objective: Specify the learning task and corresponding objective function - booster: Specify which booster to use, options are gbtree, gblinear or dart - tree_method: Specify the tree construction algorithm used in XGBoost
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].