sega_learn.svm

 
Package Contents
       
_LinearSVM_jit_utils
baseSVM
generalizedSVM
linerarSVM
oneClassSVM

 
Classes
       
builtins.object
sega_learn.svm.baseSVM.BaseSVM
sega_learn.svm.generalizedSVM.GeneralizedSVC
sega_learn.svm.generalizedSVM.GeneralizedSVR
sega_learn.svm.linerarSVM.LinearSVC
sega_learn.svm.linerarSVM.LinearSVR
sega_learn.svm.oneClassSVM.OneClassSVM

 
class BaseSVM(builtins.object)
    BaseSVM(C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, kernel='linear', degree=3, gamma='scale', coef0=0.0, regression=False)
 
BaseSVM: A base class for Support Vector Machines (SVM) with kernel support.
 
This class provides the foundation for implementing SVM models with various kernels
and supports both classification and regression tasks.
 
Attributes:
    C (float): Regularization parameter. Default is 1.0.
    tol (float): Tolerance for stopping criteria. Default is 1e-4.
    max_iter (int): Maximum number of iterations for optimization. Default is 1000.
    learning_rate (float): Step size for optimization. Default is 0.01.
    kernel (str): Kernel type ('linear', 'poly', 'rbf', or 'sigmoid'). Default is 'linear'.
    degree (int): Degree for polynomial kernel. Default is 3.
    gamma (str or float): Kernel coefficient ('scale', 'auto', or float). Default is 'scale'.
    coef0 (float): Independent term in poly and sigmoid kernels. Default is 0.0.
    regression (bool): Whether to use regression (SVR) or classification (SVC). Default is False.
    w (ndarray): Weight vector for linear kernel.
    b (float): Bias term.
    support_vectors_ (ndarray): Support vectors identified during training.
    support_vector_labels_ (ndarray): Labels of the support vectors.
    support_vector_alphas_ (ndarray): Lagrange multipliers for the support vectors.
 
Methods:
    __init__(self, C=1.0, tol=1e-4, max_iter=1000, learning_rate=0.01, kernel='linear', degree=3, gamma='scale', coef0=0.0, regression=False):
        Initializes the BaseSVM instance with specified hyperparameters.
    fit(self, X, y=None):
        Fits the SVM model to the training data.
    _fit(self, X, y):
        Abstract method to be implemented by subclasses for training.
    _compute_kernel(self, X1, X2):
        Computes the kernel function between two input matrices.
    decision_function(self, X):
        Computes the decision function for input samples.
    predict(self, X):
        Predicts class labels for input samples.
    score(self, X, y):
        Computes the mean accuracy of the model on the given test data.
    get_params(self, deep=True):
        Retrieves the hyperparameters of the model.
    set_params(self, **parameters):
        Sets the hyperparameters of the model.
    __sklearn_is_fitted__(self):
        Checks if the model has been fitted (for sklearn compatibility).
 
  Methods defined here:
__init__(self, C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, kernel='linear', degree=3, gamma='scale', coef0=0.0, regression=False)
Initializes the BaseSVM instance with specified hyperparameters.
 
Args:
    C: (float) - Regularization parameter. Default is 1.0.
    tol: (float) - Tolerance for stopping criteria. Default is 1e-4.
    max_iter: (int) - Maximum number of iterations for optimization. Default is 1000.
    learning_rate: (float) - Step size for optimization. Default is 0.01.
    kernel: (str) - Kernel type ('linear', 'poly', 'rbf', or 'sigmoid'). Default is 'linear'.
    degree: (int) - Degree for polynomial kernel. Default is 3.
    gamma: (str or float) - Kernel coefficient ('scale', 'auto', or float). Default is 'scale'.
    coef0: (float) - Independent term in poly and sigmoid kernels. Default is 0.0.
    regression: (bool) - Whether to use regression (SVR) or classification (SVC). Default is False.
__sklearn_is_fitted__(self)
Checks if the model has been fitted (for sklearn compatibility).
 
Returns:
    fitted: (bool) - True if the model has been fitted, otherwise False.
decision_function(self, X)
Computes the decision function for input samples.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Input samples.
 
Returns:
    decision_values: (ndarray of shape (n_samples,)) - Decision function values.
fit(self, X, y=None)
Fits the SVM model to the training data.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Training vectors.
    y: (array-like of shape (n_samples,)) - Target values. Default is None.
 
Returns:
    self: (BaseSVM) - The fitted instance.
get_params(self, deep=True)
Retrieves the hyperparameters of the model.
 
Args:
    deep: (bool) - If True, returns parameters of subobjects as well. Default is True.
 
Returns:
    params: (dict) - Dictionary of hyperparameter names and values.
predict(self, X)
Predicts class labels for input samples.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Input samples.
 
Returns:
    predicted_labels: (ndarray of shape (n_samples,)) - Predicted class labels.
score(self, X, y)
Computes the mean accuracy of the model on the given test data.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Test samples.
    y: (array-like of shape (n_samples,)) - True class labels.
 
Returns:
    score: (float) - Mean accuracy of predictions.
set_params(self, **parameters)
Sets the hyperparameters of the model.
 
Args:
    **parameters: (dict) - Hyperparameter names and values.
 
Returns:
    self: (BaseSVM) - The updated estimator instance.

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class GeneralizedSVC(sega_learn.svm.baseSVM.BaseSVM)
    GeneralizedSVC(C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, kernel='linear', degree=3, gamma='scale', coef0=0.0)
 
GeneralizedSVC: A Support Vector Classifier (SVC) model with support for multiple kernels.
 
This class implements an SVC model using gradient descent for optimization. It supports
linear and non-linear kernels, including polynomial and RBF kernels.
 
Attributes:
    C (float): Regularization parameter. Default is 1.0.
    tol (float): Tolerance for stopping criteria. Default is 1e-4.
    max_iter (int): Maximum number of iterations for gradient descent. Default is 1000.
    learning_rate (float): Learning rate for gradient descent. Default is 0.01.
    kernel (str): Kernel type ('linear', 'poly', 'rbf'). Default is 'linear'.
    degree (int): Degree of the polynomial kernel function ('poly'). Ignored by other kernels. Default is 3.
    gamma (str or float): Kernel coefficient for 'rbf' and 'poly'. Default is 'scale'.
    coef0 (float): Independent term in kernel function ('poly'). Default is 0.0.
 
Methods:
    __init__(self, C=1.0, tol=1e-4, max_iter=1000, learning_rate=0.01, kernel="linear", degree=3, gamma="scale", coef0=0.0):
        Initialize the GeneralizedSVC model with specified hyperparameters.
    _fit(self, X, y):
        Fit the GeneralizedSVC model to the training data using gradient descent.
    _predict_binary(self, X):
        Predict binary class labels for input samples.
    _predict_multiclass(self, X):
        Predict multi-class labels using one-vs-rest strategy.
    decision_function(self, X):
        Compute raw decision function values for input samples.
    _score_binary(self, X, y):
        Compute the accuracy score for binary classification.
    _score_multiclass(self, X, y):
        Compute the accuracy score for multi-class classification.
 
Raises:
    ValueError: If numerical instability is detected during training.
 
 
Method resolution order:
GeneralizedSVC
sega_learn.svm.baseSVM.BaseSVM
builtins.object

Methods defined here:
__init__(self, C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, kernel='linear', degree=3, gamma='scale', coef0=0.0)
Initializes the GeneralizedSVC model with specified hyperparameters.
 
Args:
    C: (float) - Regularization parameter. Default is 1.0.
    tol: (float) - Tolerance for stopping criteria. Default is 1e-4.
    max_iter: (int) - Maximum number of iterations for gradient descent. Default is 1000.
    learning_rate: (float) - Learning rate for gradient descent. Default is 0.01.
    kernel: (str) - Kernel type ('linear', 'poly', 'rbf'). Default is 'linear'.
    degree: (int) - Degree of the polynomial kernel function ('poly'). Ignored by other kernels. Default is 3.
    gamma: (str or float) - Kernel coefficient for 'rbf' and 'poly'. Default is 'scale'.
    coef0: (float) - Independent term in kernel function ('poly'). Default is 0.0.
decision_function(self, X)
Compute raw decision function values for input samples.

Methods inherited from sega_learn.svm.baseSVM.BaseSVM:
__sklearn_is_fitted__(self)
Checks if the model has been fitted (for sklearn compatibility).
 
Returns:
    fitted: (bool) - True if the model has been fitted, otherwise False.
fit(self, X, y=None)
Fits the SVM model to the training data.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Training vectors.
    y: (array-like of shape (n_samples,)) - Target values. Default is None.
 
Returns:
    self: (BaseSVM) - The fitted instance.
get_params(self, deep=True)
Retrieves the hyperparameters of the model.
 
Args:
    deep: (bool) - If True, returns parameters of subobjects as well. Default is True.
 
Returns:
    params: (dict) - Dictionary of hyperparameter names and values.
predict(self, X)
Predicts class labels for input samples.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Input samples.
 
Returns:
    predicted_labels: (ndarray of shape (n_samples,)) - Predicted class labels.
score(self, X, y)
Computes the mean accuracy of the model on the given test data.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Test samples.
    y: (array-like of shape (n_samples,)) - True class labels.
 
Returns:
    score: (float) - Mean accuracy of predictions.
set_params(self, **parameters)
Sets the hyperparameters of the model.
 
Args:
    **parameters: (dict) - Hyperparameter names and values.
 
Returns:
    self: (BaseSVM) - The updated estimator instance.

Data descriptors inherited from sega_learn.svm.baseSVM.BaseSVM:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class GeneralizedSVR(sega_learn.svm.baseSVM.BaseSVM)
    GeneralizedSVR(C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, epsilon=0.1, kernel='linear', degree=3, gamma='scale', coef0=0.0)
 
GeneralizedSVR: A Support Vector Regression (SVR) model with support for multiple kernels.
 
This class implements an SVR model using gradient descent for optimization. It supports
linear and non-linear kernels, including polynomial and RBF kernels.
 
Attributes:
    C (float): Regularization parameter. Default is 1.0.
    tol (float): Tolerance for stopping criteria. Default is 1e-4.
    max_iter (int): Maximum number of iterations for gradient descent. Default is 1000.
    learning_rate (float): Learning rate for gradient descent. Default is 0.01.
    epsilon (float): Epsilon parameter for epsilon-insensitive loss. Default is 0.1.
    kernel (str): Kernel type ('linear', 'poly', 'rbf'). Default is 'linear'.
    degree (int): Degree of the polynomial kernel function ('poly'). Ignored by other kernels. Default is 3.
    gamma (str or float): Kernel coefficient for 'rbf' and 'poly'. Default is 'scale'.
    coef0 (float): Independent term in kernel function ('poly'). Default is 0.0.
 
Methods:
    __init__(self, C=1.0, tol=1e-4, max_iter=1000, learning_rate=0.01, epsilon=0.1, kernel="linear", degree=3, gamma="scale", coef0=0.0):
        Initialize the GeneralizedSVR model with specified hyperparameters.
    _fit(self, X, y):
        Fit the GeneralizedSVR model to the training data using gradient descent.
    predict(self, X):
        Predict continuous target values for input samples.
    decision_function(self, X):
        Compute raw decision function values for input samples.
    score(self, X, y):
        Compute the coefficient of determination (R² score) for the model's predictions.
 
Raises:
    ValueError: If numerical instability is detected during training.
 
 
Method resolution order:
GeneralizedSVR
sega_learn.svm.baseSVM.BaseSVM
builtins.object

Methods defined here:
__init__(self, C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, epsilon=0.1, kernel='linear', degree=3, gamma='scale', coef0=0.0)
Initializes the GeneralizedSVR model with specified hyperparameters.
 
Args:
    C: (float) - Regularization parameter. Default is 1.0.
    tol: (float) - Tolerance for stopping criteria. Default is 1e-4.
    max_iter: (int) - Maximum number of iterations for gradient descent. Default is 1000.
    learning_rate: (float) - Learning rate for gradient descent. Default is 0.01.
    epsilon: (float) - Epsilon parameter for epsilon-insensitive loss. Default is 0.1.
    kernel: (str) - Kernel type ('linear', 'poly', 'rbf'). Default is 'linear'.
    degree: (int) - Degree of the polynomial kernel function ('poly'). Ignored by other kernels. Default is 3.
    gamma: (str or float) - Kernel coefficient for 'rbf' and 'poly'. Default is 'scale'.
    coef0: (float) - Independent term in kernel function ('poly'). Default is 0.0.
decision_function(self, X)
Compute raw decision function values for input samples.
predict(self, X)
Predict continuous target values for input samples.
score(self, X, y)
Compute the coefficient of determination (R² score) for the model's predictions.

Methods inherited from sega_learn.svm.baseSVM.BaseSVM:
__sklearn_is_fitted__(self)
Checks if the model has been fitted (for sklearn compatibility).
 
Returns:
    fitted: (bool) - True if the model has been fitted, otherwise False.
fit(self, X, y=None)
Fits the SVM model to the training data.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Training vectors.
    y: (array-like of shape (n_samples,)) - Target values. Default is None.
 
Returns:
    self: (BaseSVM) - The fitted instance.
get_params(self, deep=True)
Retrieves the hyperparameters of the model.
 
Args:
    deep: (bool) - If True, returns parameters of subobjects as well. Default is True.
 
Returns:
    params: (dict) - Dictionary of hyperparameter names and values.
set_params(self, **parameters)
Sets the hyperparameters of the model.
 
Args:
    **parameters: (dict) - Hyperparameter names and values.
 
Returns:
    self: (BaseSVM) - The updated estimator instance.

Data descriptors inherited from sega_learn.svm.baseSVM.BaseSVM:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class LinearSVC(sega_learn.svm.baseSVM.BaseSVM)
    LinearSVC(C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, numba=False)
 
LinearSVC is a linear Support Vector Classifier (SVC) implementation that uses gradient descent for optimization.
 
It supports binary and multi-class classification using a one-vs-rest strategy.
 
Attributes:
    C (float): Regularization parameter. Default is 1.0.
    tol (float): Tolerance for stopping criteria. Default is 1e-4.
    max_iter (int): Maximum number of iterations for gradient descent. Default is 1000.
    learning_rate (float): Learning rate for gradient descent. Default is 0.01.
    numba (bool): Whether to use Numba-accelerated computations. Default is False.
    w (ndarray): Weight vector for the linear model.
    b (float): Bias term for the linear model.
    numba_available (bool): Indicates if Numba is available for use.
 
Methods:
    __init__(self, C=1.0, tol=1e-4, max_iter=1000, learning_rate=0.01, numba=False):
        Initializes the LinearSVC instance with hyperparameters and checks for Numba availability.
    _fit(self, X, y):
        Fits the LinearSVC model to the training data using gradient descent.
    _predict_binary(self, X):
        Predicts class labels {-1, 1} for binary classification.
    _predict_multiclass(self, X):
        Predicts class labels for multi-class classification using one-vs-rest strategy.
    decision_function(self, X):
        Computes raw decision function values before thresholding.
    _score_binary(self, X, y):
        Computes the mean accuracy of predictions for binary classification.
    _score_multiclass(self, X, y):
        Computes the mean accuracy of predictions for multi-class classification.
 
 
Method resolution order:
LinearSVC
sega_learn.svm.baseSVM.BaseSVM
builtins.object

Methods defined here:
__init__(self, C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, numba=False)
Initializes the LinearSVC instance with hyperparameters and checks for Numba availability.
 
Args:
    C: (float) - Regularization parameter. Default is 1.0.
    tol: (float) - Tolerance for stopping criteria. Default is 1e-4.
    max_iter: (int) - Maximum number of iterations for gradient descent. Default is 1000.
    learning_rate: (float) - Learning rate for gradient descent. Default is 0.01.
    numba: (bool) - Whether to use Numba-accelerated computations. Default is False.
decision_function(self, X)
Compute raw decision function values before thresholding.
 
Args:
    X (array-like of shape (n_samples, n_features)): Input samples.
 
Returns:
    scores (array of shape (n_samples,)): Decision function values.

Methods inherited from sega_learn.svm.baseSVM.BaseSVM:
__sklearn_is_fitted__(self)
Checks if the model has been fitted (for sklearn compatibility).
 
Returns:
    fitted: (bool) - True if the model has been fitted, otherwise False.
fit(self, X, y=None)
Fits the SVM model to the training data.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Training vectors.
    y: (array-like of shape (n_samples,)) - Target values. Default is None.
 
Returns:
    self: (BaseSVM) - The fitted instance.
get_params(self, deep=True)
Retrieves the hyperparameters of the model.
 
Args:
    deep: (bool) - If True, returns parameters of subobjects as well. Default is True.
 
Returns:
    params: (dict) - Dictionary of hyperparameter names and values.
predict(self, X)
Predicts class labels for input samples.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Input samples.
 
Returns:
    predicted_labels: (ndarray of shape (n_samples,)) - Predicted class labels.
score(self, X, y)
Computes the mean accuracy of the model on the given test data.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Test samples.
    y: (array-like of shape (n_samples,)) - True class labels.
 
Returns:
    score: (float) - Mean accuracy of predictions.
set_params(self, **parameters)
Sets the hyperparameters of the model.
 
Args:
    **parameters: (dict) - Hyperparameter names and values.
 
Returns:
    self: (BaseSVM) - The updated estimator instance.

Data descriptors inherited from sega_learn.svm.baseSVM.BaseSVM:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class LinearSVR(sega_learn.svm.baseSVM.BaseSVM)
    LinearSVR(C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, epsilon=0.1, numba=False)
 
LinearSVR: A linear Support Vector Regression (SVR) model using epsilon-insensitive loss.
 
This class implements a linear SVR model with support for mini-batch gradient descent
and optional acceleration using Numba. It is designed for regression tasks and uses
epsilon-insensitive loss to handle errors within a specified margin.
 
Attributes:
    C (float): Regularization parameter. Default is 1.0.
    tol (float): Tolerance for stopping criteria. Default is 1e-4.
    max_iter (int): Maximum number of iterations for gradient descent. Default is 1000.
    learning_rate (float): Learning rate for gradient descent. Default is 0.01.
    epsilon (float): Epsilon parameter for epsilon-insensitive loss. Default is 0.1.
    numba (bool): Whether to use Numba for acceleration. Default is False.
    w (ndarray): Weight vector of the model.
    b (float): Bias term of the model.
    numba_available (bool): Indicates if Numba is available for acceleration.
    X_train (ndarray): Training data used for fitting.
    y_train (ndarray): Target values used for fitting.
 
Methods:
    __init__(self, C=1.0, tol=1e-4, max_iter=1000, learning_rate=0.01, epsilon=0.1, numba=False):
        Initialize the LinearSVR model with specified hyperparameters.
    _fit(self, X, y):
        Fit the LinearSVR model to the training data using mini-batch gradient descent.
    predict(self, X):
        Predict continuous target values for input samples.
    decision_function(self, X):
        Compute raw decision function values for input samples.
    score(self, X, y):
        Compute the coefficient of determination (R² score) for the model's predictions.
 
Raises:
    ValueError: If a non-linear kernel is specified, as LinearSVR only supports linear kernels.
 
 
Method resolution order:
LinearSVR
sega_learn.svm.baseSVM.BaseSVM
builtins.object

Methods defined here:
__init__(self, C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, epsilon=0.1, numba=False)
Initializes the LinearSVR instance with hyperparameters and checks for Numba availability.
 
Args:
    C: (float) - Regularization parameter. Default is 1.0.
    tol: (float) - Tolerance for stopping criteria. Default is 1e-4.
    max_iter: (int) - Maximum number of iterations for gradient descent. Default is 1000.
    learning_rate: (float) - Learning rate for gradient descent. Default is 0.01.
    epsilon: (float) - Epsilon parameter for epsilon-insensitive loss. Default is 0.1.
    numba: (bool) - Whether to use Numba-accelerated computations. Default is False.
 
Returns:
    None
decision_function(self, X)
Compute raw decision function values.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Input samples.
 
Returns:
    scores: (array of shape (n_samples,)) - Predicted values.
predict(self, X)
Predict continuous target values for input samples.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Input samples.
 
Returns:
    y_pred: (array of shape (n_samples,)) - Predicted values.
score(self, X, y)
Compute the coefficient of determination (R² score).
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Test samples.
    y: (array-like of shape (n_samples,)) - True target values.
 
Returns:
    score: (float) - R² score of predictions.

Methods inherited from sega_learn.svm.baseSVM.BaseSVM:
__sklearn_is_fitted__(self)
Checks if the model has been fitted (for sklearn compatibility).
 
Returns:
    fitted: (bool) - True if the model has been fitted, otherwise False.
fit(self, X, y=None)
Fits the SVM model to the training data.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Training vectors.
    y: (array-like of shape (n_samples,)) - Target values. Default is None.
 
Returns:
    self: (BaseSVM) - The fitted instance.
get_params(self, deep=True)
Retrieves the hyperparameters of the model.
 
Args:
    deep: (bool) - If True, returns parameters of subobjects as well. Default is True.
 
Returns:
    params: (dict) - Dictionary of hyperparameter names and values.
set_params(self, **parameters)
Sets the hyperparameters of the model.
 
Args:
    **parameters: (dict) - Hyperparameter names and values.
 
Returns:
    self: (BaseSVM) - The updated estimator instance.

Data descriptors inherited from sega_learn.svm.baseSVM.BaseSVM:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class OneClassSVM(sega_learn.svm.baseSVM.BaseSVM)
    OneClassSVM(C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, kernel='linear', degree=3, gamma='scale', coef0=0.0)
 
OneClassSVM is a custom implementation of a One-Class Support Vector Machine (SVM) for anomaly detection using gradient descent.
 
It inherits from the BaseSVM class and supports various kernel functions.
 
Attributes:
    support_vectors_ (array-like of shape (n_support_vectors, n_features)):
        The support vectors identified during training.
    support_vector_alphas_ (array-like of shape (n_support_vectors,)):
        The Lagrange multipliers (alpha) corresponding to the support vectors.
    b (float):
        The bias term (rho) computed during training.
 
Methods:
    __init__(C=1.0, tol=1e-4, max_iter=1000, learning_rate=0.01, kernel="linear",
             degree=3, gamma="scale", coef0=0.0):
        Initialize the OneClassSVM with hyperparameters.
    _fit(X, y=None):
        Fit the OneClassSVM model using gradient descent for anomaly detection.
    decision_function(X):
        Compute the decision function values for the input samples.
    predict(X):
        Predict whether the input samples are inliers (1) or outliers (-1).
    score(X, y):
        Compute the mean accuracy of predictions compared to true labels.
    __sklearn_is_fitted__():
        Check if the model has been fitted. For compatibility with sklearn.
 
 
Method resolution order:
OneClassSVM
sega_learn.svm.baseSVM.BaseSVM
builtins.object

Methods defined here:
__init__(self, C=1.0, tol=0.0001, max_iter=1000, learning_rate=0.01, kernel='linear', degree=3, gamma='scale', coef0=0.0)
Initialize the OneClassSVM with hyperparameters.
 
Args:
    C: (float) - Regularization parameter (default is 1.0).
    tol: (float) - Tolerance for stopping criteria (default is 1e-4).
    max_iter: (int) - Maximum number of iterations (default is 1000).
    learning_rate: (float) - Learning rate for gradient descent (default is 0.01).
    kernel: (str) - Kernel type ("linear", "poly", "rbf", "sigmoid") (default is "linear").
    degree: (int) - Degree for polynomial kernel (default is 3).
    gamma: (str or float) - Kernel coefficient ("scale", "auto", or float) (default is "scale").
    coef0: (float) - Independent term in kernel function (default is 0.0).
__sklearn_is_fitted__(self)
Check if the model has been fitted. For compatibility with sklearn.
 
Returns:
    fitted: (bool) - True if the model has been fitted, otherwise False.
decision_function(self, X)
Compute the decision function values for the input samples.
predict(self, X)
Predict whether the input samples are inliers (1) or outliers (-1).
score(self, X, y)
Compute the mean accuracy of predictions.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Test samples.
    y: (array-like of shape (n_samples,)) - True labels (+1 for inliers, -1 for outliers).
 
Returns:
    score: (float) - Mean accuracy of predictions.

Methods inherited from sega_learn.svm.baseSVM.BaseSVM:
fit(self, X, y=None)
Fits the SVM model to the training data.
 
Args:
    X: (array-like of shape (n_samples, n_features)) - Training vectors.
    y: (array-like of shape (n_samples,)) - Target values. Default is None.
 
Returns:
    self: (BaseSVM) - The fitted instance.
get_params(self, deep=True)
Retrieves the hyperparameters of the model.
 
Args:
    deep: (bool) - If True, returns parameters of subobjects as well. Default is True.
 
Returns:
    params: (dict) - Dictionary of hyperparameter names and values.
set_params(self, **parameters)
Sets the hyperparameters of the model.
 
Args:
    **parameters: (dict) - Hyperparameter names and values.
 
Returns:
    self: (BaseSVM) - The updated estimator instance.

Data descriptors inherited from sega_learn.svm.baseSVM.BaseSVM:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
Data
        __all__ = ['BaseSVM', 'LinearSVC', 'LinearSVR', 'OneClassSVM', 'GeneralizedSVR', 'GeneralizedSVC']