API reference#
CompositeKernel#
- class svdynamics.CompositeKernel(kernels: Sequence[str | Tuple[str, Dict[str, Any]] | Any], weights: Sequence[float] | None = None, normalize: bool = True, eps: float = 1e-12)[source]#
Bases:
objectCompositeKernel builds a callable kernel that is a weighted sum of base kernels.
K(X, Y) = sum_m w_m * K_m(X, Y)
Parameters#
- kernels:
List of kernel specs. Each element can be: - “rbf” | “linear” | “poly” | “sigmoid” - (“rbf”, {“gamma”: 0.1}) etc. - callable kernel(X, Y) -> ndarray
- weights:
Optional weights for kernels. If None, uniform weights are used. Weights are normalized to sum to 1.
- normalize:
If True, each base kernel is rescaled by a scalar derived from K(X, X) to reduce dominance due to scale.
- eps:
Small constant used for numerical stability.
- eps: float = 1e-12#
- kernels: Sequence[str | Tuple[str, Dict[str, Any]] | Any]#
- normalize: bool = True#
- property normalized_weights: ndarray#
- property parsed_kernels: List[ParsedKernel]#
- weights: Sequence[float] | None = None#
SVDClassifier#
- class svdynamics.SVDClassifier(C: float = 1.0, kernel: str | CompositeKernel | Any = 'rbf', degree: int = 3, gamma: str | float = 'scale', coef0: float = 0.0, shrinking: bool = True, probability: bool = False, tol: float = 0.001, cache_size: float = 200.0, class_weight: Dict[Any, float] | 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:
BaseEstimator,ClassifierMixinSVDClassifier is a thin wrapper around sklearn.svm.SVC that supports CompositeKernel.
If kernel is a CompositeKernel, the estimator uses a callable kernel. Otherwise it passes through to sklearn SVC.
- C: float = 1.0#
- break_ties: bool = False#
- cache_size: float = 200.0#
- class_weight: Dict[Any, float] | None = None#
- coef0: float = 0.0#
- decision_function_shape: str = 'ovr'#
- degree: int = 3#
- fit(X: ndarray, y: ndarray) SVDClassifier[source]#
- gamma: str | float = 'scale'#
- kernel: str | CompositeKernel | Any = 'rbf'#
- max_iter: int = -1#
- property n_support_: ndarray#
- probability: bool = False#
- random_state: int | None = None#
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') SVDClassifier#
Request metadata passed to the
scoremethod.Note that this method is only relevant if
enable_metadata_routing=True(seesklearn.set_config()). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Note
This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a
Pipeline. Otherwise it has no effect.Parameters#
- sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED
Metadata routing for
sample_weightparameter inscore.
Returns#
- selfobject
The updated object.
- shrinking: bool = True#
- property support_vectors_: ndarray#
- tol: float = 0.001#
- verbose: bool = False#
SVDRegressor#
- class svdynamics.SVDRegressor(C: float = 1.0, kernel: str | CompositeKernel | Any = 'rbf', degree: int = 3, gamma: str | float = 'scale', coef0: float = 0.0, tol: float = 0.001, epsilon: float = 0.1, shrinking: bool = True, cache_size: float = 200.0, verbose: bool = False, max_iter: int = -1)[source]#
Bases:
BaseEstimator,RegressorMixinSVDRegressor is a thin wrapper around sklearn.svm.SVR that supports CompositeKernel.
- C: float = 1.0#
- cache_size: float = 200.0#
- coef0: float = 0.0#
- degree: int = 3#
- epsilon: float = 0.1#
- fit(X: ndarray, y: ndarray) SVDRegressor[source]#
- gamma: str | float = 'scale'#
- kernel: str | CompositeKernel | Any = 'rbf'#
- max_iter: int = -1#
- set_score_request(*, sample_weight: bool | None | str = '$UNCHANGED$') SVDRegressor#
Request metadata passed to the
scoremethod.Note that this method is only relevant if
enable_metadata_routing=True(seesklearn.set_config()). Please see User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed toscoreif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it toscore.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.
Note
This method is only relevant if this estimator is used as a sub-estimator of a meta-estimator, e.g. used inside a
Pipeline. Otherwise it has no effect.Parameters#
- sample_weightstr, True, False, or None, default=sklearn.utils.metadata_routing.UNCHANGED
Metadata routing for
sample_weightparameter inscore.
Returns#
- selfobject
The updated object.
- shrinking: bool = True#
- property support_: ndarray#
- tol: float = 0.001#
- verbose: bool = False#