Skip to content

Commit

Permalink
Backport Python 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhao062 authored and yuezhao@cs.toronto.edu committed Jun 1, 2018
1 parent 582dbae commit b9567fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
@@ -1,7 +1,7 @@
language: python
python:
# - "2.7"
# - "3.3" # failed due to setuptool version
- "2.7"
# - "3.3" # failed due to setuptool version
- "3.4"
- "3.5"
- "3.5-dev" # 3.5 development branch
Expand Down
15 changes: 9 additions & 6 deletions pyod/models/base.py
Expand Up @@ -7,10 +7,12 @@
import warnings
from inspect import signature
from collections import defaultdict
from abc import ABC, abstractmethod
# from abc import ABC, abstractmethod

import numpy as np
import six
import abc

import numpy as np
from scipy import sparse
from scipy.stats import rankdata
from scipy.special import erf
Expand Down Expand Up @@ -190,7 +192,8 @@ def _pprint(params, offset=0, printer=repr):
return lines


class BaseDetector(ABC):
@six.add_metaclass(abc.ABCMeta)
class BaseDetector(object):
"""
Abstract class for all outlier detection algorithms.
Expand All @@ -200,7 +203,7 @@ class BaseDetector(ABC):
:type contamination: float in (0., 0.5), optional (default=0.1)
"""

@abstractmethod
@abc.abstractmethod
def __init__(self, contamination=0.1):

if not (0. < contamination <= 0.5):
Expand All @@ -209,7 +212,7 @@ def __init__(self, contamination=0.1):

self.contamination = contamination

@abstractmethod
@abc.abstractmethod
def decision_function(self, X):
"""
Predict Anomaly score of X of the base classifiers. The anomaly score
Expand All @@ -225,7 +228,7 @@ def decision_function(self, X):
"""
pass

@abstractmethod
@abc.abstractmethod
def fit(self, X, y=None):
"""
Fit detector.
Expand Down

0 comments on commit b9567fa

Please sign in to comment.