Skip to content

Commit bce04a3

Browse files
committed
Merge branch 'master' into master
2 parents fecc606 + 1079085 commit bce04a3

File tree

16 files changed

+97
-74
lines changed

16 files changed

+97
-74
lines changed

.github/workflows/linting.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Libact linting
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ${{ matrix.os }}
9+
continue-on-error: True
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [ubuntu-latest]
14+
python-version: [3.9]
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install pylint
26+
- run: pylint libact

.github/workflows/tests.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Libact tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-latest, macos-latest]
13+
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
- name: Install dependencies
22+
run: |
23+
if [ "$RUNNER_OS" = "macOS" ]; then
24+
brew update
25+
brew install openblas
26+
mkdir -p ~/.matplotlib
27+
echo "backend: TkAgg" >> ~/.matplotlib/matplotlibrc
28+
else
29+
sudo apt-get update -qq
30+
sudo apt-get install -y build-essential gfortran libatlas-base-dev liblapacke-dev
31+
sudo apt-get install -y python3-dev
32+
fi
33+
python -m pip install --upgrade pip
34+
pip install pylint coverage codecov
35+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
36+
- name: Install Libact
37+
run: |
38+
./setup.py build_ext --inplace
39+
- name: Unittests
40+
run: |
41+
python -m unittest -v
42+
- run: coverage run --source libact --omit */tests/* setup.py test
43+
- run: coverage report
44+
- run: codecov

.pylintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ bad-functions=map,filter
3838
# w, W - weight vector
3939
# N - number of instances
4040
# T, K - number of iterations
41-
good-names=i,j,k,_,X,Y,x,y,P,p,qs,w,W,N,T,K
41+
good-names=i,j,k,_,X,Y,Z,x,y,P,p,qs,w,W,N,T,K
4242

4343
# Regular expression matching correct attribute names
4444
attr-rgx=[a-z_][a-z0-9_]{2,30}$
@@ -84,7 +84,7 @@ generated-members=
8484
[FORMAT]
8585

8686
# Maximum number of characters on a single line.
87-
max-line-length=79
87+
max-line-length=120
8888

8989
# List of optional constructs for which whitespace checking is disabled. `dict-
9090
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.

.travis.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

libact/base/tests/test_dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def test_get_labeled_entries(self):
7575

7676
def test_get_unlabeled_entries(self):
7777
dataset = self.setup_dataset()
78-
idx, X = dataset.get_unlabeled_entries()
78+
_, X = dataset.get_unlabeled_entries()
7979
self.assertTrue(np.array_equal(X[0], np.array([6, 7, 8])))
8080
self.assertTrue(np.array_equal(X[1], np.array([12, 13, 14])))
8181

libact/models/sklearn_adapter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ class SklearnProbaAdapter(ProbabilisticModel):
9292
"""
9393

9494
def __init__(self, clf):
95+
super().__init__()
9596
self._model = clf
9697

9798
def train(self, dataset, *args, **kwargs):

libact/models/tests/test_svm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def setUp(self):
2929
def test_svm(self):
3030
svc_clf = SVC(gamma="auto")
3131
svc_clf.fit(self.X_train, self.y_train)
32-
svm = SVM()
32+
svm = SVM(gamma="auto")
3333
svm.train(Dataset(self.X_train, self.y_train))
3434

3535
assert_array_equal(

libact/query_strategies/multiclass/mdsp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99
# Licence: BSD
1010

1111
import numpy as np
12+
import sklearn
1213

1314
import warnings
1415

1516
from sklearn.base import BaseEstimator
1617
from sklearn.metrics import euclidean_distances
1718
from sklearn.utils import check_random_state, check_array, check_symmetric
1819
from joblib import Parallel, delayed
20+
1921
from sklearn.isotonic import IsotonicRegression
2022

2123

libact/query_strategies/multiclass/tests/test_hierarchical_sampling.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def test_hs_random_selecting(self):
2929
qseq = run_qs(ds, qs, self.y, len(self.y)-10)
3030
assert_array_equal(
3131
np.concatenate([qseq[:10], qseq[-10:]]),
32-
np.array([48, 143, 13, 142, 88, 130, 29, 87, 36, 28,
33-
58, 137, 49, 105, 76, 71, 63, 47, 64, 55])
32+
np.array([39, 126, 66, 135, 37, 33, 118, 132, 142, 144,
33+
71, 28, 63, 41, 140, 34, 20, 110, 136, 36])
3434
)
3535

3636
def test_hs_active_selecting(self):
@@ -39,8 +39,8 @@ def test_hs_active_selecting(self):
3939
qseq = run_qs(ds, qs, self.y, len(self.y)-10)
4040
assert_array_equal(
4141
np.concatenate([qseq[:10], qseq[-10:]]),
42-
np.array([48, 143, 13, 64, 101, 108, 51, 87, 36, 28,
43-
43, 118, 47, 25, 81, 82, 95, 40, 67, 120])
42+
np.array([39, 126, 66, 135, 37, 33, 118, 132, 142, 144,
43+
89, 117, 48, 67, 75, 14, 79, 62, 105, 19])
4444
)
4545

4646
def test_hs_subsampling(self):
@@ -52,7 +52,7 @@ def test_hs_subsampling(self):
5252
assert_array_equal(
5353
np.concatenate([qseq[:10], qseq[-10:]]),
5454
np.array([120, 50, 33, 28, 78, 133, 52, 124, 102, 109,
55-
81, 108, 12, 10, 89, 114, 92, 126, 48, 25])
55+
81, 108, 10, 89, 126, 114, 92, 48, 25, 13])
5656
)
5757

5858
def test_hs_report_all_label(self):

libact/query_strategies/multilabel/adaptive_active_learning.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from joblib import Parallel, delayed
77

88
from libact.base.dataset import Dataset
9-
from libact.base.interfaces import QueryStrategy, ContinuousModel
10-
from libact.utils import inherit_docstring_from, seed_random_state, zip
9+
from libact.base.interfaces import QueryStrategy
10+
from libact.utils import inherit_docstring_from, seed_random_state
1111
from libact.models.multilabel import BinaryRelevance
1212

1313

@@ -77,12 +77,13 @@ class AdaptiveActiveLearning(QueryStrategy):
7777

7878
def __init__(self, dataset, base_clf, betas=None, n_jobs=1,
7979
random_state=None):
80-
super(AdaptiveActiveLearning, self).__init__(dataset)
80+
super().__init__(dataset)
8181

8282
self.n_labels = len(self.dataset.data[0][1])
8383

8484
self.base_clf = copy.deepcopy(base_clf)
8585

86+
# pyline: disable=fixme
8687
# TODO check beta value
8788
self.betas = betas
8889
if self.betas is None:

0 commit comments

Comments
 (0)