pdmlabs.experiment.batch.semi_supervised_experiment#
Classes
|
Semi-supervised anomaly detection with per-scenario learning. |
- class pdmlabs.experiment.batch.semi_supervised_experiment.SemiSupervisedPdMExperiment(experiment_name: str, pipeline: PdMPipeline, param_space: dict, constraint_function: Callable = None, target_data: list[DataFrame] = None, target_sources: list[str] = None, historic_data: list[DataFrame] = [], historic_sources: list[str] = [], optimization_param: str = 'AD1_AUC', initial_random: int = 2, num_iteration: int = 20, batch_size: int = 1, n_jobs: int = 1, random_state: int = 42, random_n_tries: int = 3, constraint_max_retries: int = 10, historic_data_header: str = 'infer', target_data_header: str = 'infer', artifacts: str = 'artifacts', debug: bool = False, delay: float = None, log_best_scores: bool = False, maximize: bool = True, custom_evaluators: list = None)#
Bases:
PdMExperimentSemi-supervised anomaly detection with per-scenario learning.
This experiment flavor implements adaptive, scenario-specific anomaly detection: 1. For each target scenario, treats it as a self-contained learning problem 2. Fits method on the entire target scenario (unsupervised learning) 3. No reference data or cross-scenario knowledge transfer
Different from: - Supervised: no labels available - AutoProfile: doesnβt use an initial profile - Unsupervised fit: fits once globally; semi-supervised fits per-scenario
Useful when: - You have multiple target scenarios with different characteristics - You want scenario-specific adaptation - Scenarios are independent or have unknown relationships
- Raises:
IncompatibleMethodException β If method does not implement SemiSupervisedMethodInterface.
Examples
>>> experiment = SemiSupervisedPdMExperiment( ... experiment_name='semisup-demo', ... pipeline=pipeline, ... param_space={'method_n_neighbors': [5, 10, 20]}, ... num_iteration=25 ... ) >>> results = experiment.execute()
- execute() dict#
Run semi-supervised experiment with per-scenario fitting.
Fits method independently for each target scenario, adapting to local characteristics. For each parameter combination:
For each target scenario (if segmented by reset/failure)
Aggregates evaluations across scenarios
Returns best parameters
- Returns:
Result dictionary with best_params, best_objective, and threshold.
- Return type:
dict
- Raises:
IncompatibleMethodException β If method is not SemiSupervisedMethodInterface.