SVM Models API¶
Both public classes are experimental heuristics. They do not claim equivalence to a published incremental One-Class SVM optimizer.
IncrementalOneClassSVMAdaptiveKernel ¶
IncrementalOneClassSVMAdaptiveKernel(nu: float = 0.1, initial_gamma: float = 1.0, gamma_bounds: tuple[float, float] = (0.001, 100.0), adaptation_rate: float = 0.1, buffer_size: int = 200, sv_budget: int = 100, tolerance: float = 1e-06, seed: int | None = None)
Bases: BaseModel
Experimental incremental one-class kernel model with adaptive gamma.
This is a custom budgeted support-vector heuristic, not an implementation of a published incremental One-Class SVM optimizer. Support vectors and the recent-data buffer are stored in raw feature coordinates. Kernel values are computed after applying the current running standardization to both operands, so all comparisons use one consistent coordinate system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nu
|
float
|
Heuristic support-vector weight scale in |
0.1
|
initial_gamma
|
float
|
Initial positive RBF-kernel coefficient. |
1.0
|
gamma_bounds
|
tuple[float, float]
|
Positive inclusive lower and upper bounds for adaptive
gamma. The interval must contain |
(0.001, 100.0)
|
adaptation_rate
|
float
|
Interpolation fraction in |
0.1
|
buffer_size
|
int
|
Maximum recent raw samples used to estimate gamma. |
200
|
sv_budget
|
int
|
Maximum retained support vectors. |
100
|
tolerance
|
float
|
Non-negative margin tolerance used for support-vector
insertion and |
1e-06
|
seed
|
int | None
|
Seed for the model-local subsampling generator used by gamma estimation. |
None
|
score_one ¶
Compute anomaly score (higher means more anomalous).
GraphGatedOneClassSVM ¶
GraphGatedOneClassSVM(graph: dict[int, list[int]] | None = None, threshold: float = 0.0, learning_rate: float = 0.01, nu: float = 0.5, lambda_reg: float = 0.01)
Bases: BaseModel
Graph-gated ensemble of incremental linear one-class SVM heuristics.
The graph determines which node models are updated and scored. This custom anomaly detector is unrelated to the published GADGET distributed averaging and optimization algorithm.
Traversal starts at nodes with no incoming edge. A node's outgoing edges
are traversed only when its local score exceeds threshold. Each visited
node owns an incremental linear hinge-style heuristic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
graph
|
dict[int, list[int]] | None
|
Directed adjacency mapping from integer node identifiers to
child-node lists. |
None
|
threshold
|
float
|
Local score gate for traversing outgoing edges. |
0.0
|
learning_rate
|
float
|
Step size used by every node model. |
0.01
|
nu
|
float
|
Coefficient in every node model's bias update. This custom update does not provide the guarantees of a solved One-Class SVM. |
0.5
|
lambda_reg
|
float
|
Weight-decay coefficient used by every node model. |
0.01
|