Skip to content

Commit

Permalink
Smaller fixes (#76)
Browse files Browse the repository at this point in the history
* Removed unnecessary print-statement

* Added kwargs to BaseDetector.fit()
  • Loading branch information
LouisCarpentier42 authored Jan 17, 2025
1 parent 3778b9c commit c373466
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dtaianomaly/anomaly_detection/BaseDetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, supervision: Supervision):
self.supervision = supervision

@abc.abstractmethod
def fit(self, X: np.ndarray, y: Optional[np.ndarray] = None) -> 'BaseDetector':
def fit(self, X: np.ndarray, y: Optional[np.ndarray] = None, **kwargs) -> 'BaseDetector':
"""
Abstract method, fit this detector to the given data.
Expand Down
2 changes: 1 addition & 1 deletion dtaianomaly/anomaly_detection/MedianMethod.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, neighborhood_size_before: int, neighborhood_size_after: Optio
self.neighborhood_size_before = neighborhood_size_before
self.neighborhood_size_after = neighborhood_size_after

def fit(self, X: np.ndarray, y: Optional[np.ndarray] = None) -> 'BaseDetector':
def fit(self, X: np.ndarray, y: Optional[np.ndarray] = None, **kwargs) -> 'BaseDetector':
return self # No fitting is required.

def decision_function(self, X: np.ndarray) -> np.ndarray:
Expand Down
6 changes: 3 additions & 3 deletions dtaianomaly/anomaly_detection/baselines/baselines.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AlwaysNormal(BaseDetector):
def __init__(self):
super().__init__(Supervision.UNSUPERVISED)

def fit(self, X: np.ndarray, y: Optional[np.ndarray] = None) -> 'AlwaysNormal':
def fit(self, X: np.ndarray, y: Optional[np.ndarray] = None, **kwargs) -> 'AlwaysNormal':
"""
Simply return this detector, because no fitting is required.
Expand Down Expand Up @@ -67,7 +67,7 @@ class AlwaysAnomalous(BaseDetector):
def __init__(self):
super().__init__(Supervision.UNSUPERVISED)

def fit(self, X: np.ndarray, y: Optional[np.ndarray] = None) -> 'AlwaysAnomalous':
def fit(self, X: np.ndarray, y: Optional[np.ndarray] = None, **kwargs) -> 'AlwaysAnomalous':
"""
Simply return this detector, because no fitting is required.
Expand Down Expand Up @@ -126,7 +126,7 @@ def __init__(self, seed: Optional[int] = None):
super().__init__(Supervision.UNSUPERVISED)
self.seed = seed

def fit(self, X: np.ndarray, y: Optional[np.ndarray] = None) -> 'RandomDetector':
def fit(self, X: np.ndarray, y: Optional[np.ndarray] = None, **kwargs) -> 'RandomDetector':
"""
Simply return this detector, because no fitting is required.
Expand Down
1 change: 0 additions & 1 deletion dtaianomaly/anomaly_detection/windowing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ def compute_window_size(

# Use the fft to compute a window size
elif window_size == 'fft':
print('REACHED')
window_size_ = _dominant_fourier_frequency(X, lower_bound=lower_bound, upper_bound=upper_bound)

# Use the acf to compute a window size
Expand Down

0 comments on commit c373466

Please sign in to comment.