Skip to content

Commit

Permalink
Merge pull request #42 from gmrukwa/develop
Browse files Browse the repository at this point in the history
Release v2.3.19
  • Loading branch information
gmrukwa committed Jan 16, 2020
2 parents 0a06fb1 + f536af3 commit 7986212
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
env:
MAJOR: ${{ 2 }}
MINOR: ${{ 3 }}
FIXUP: ${{ 18 }}
FIXUP: ${{ 19 }}
PACKAGE_INIT_FILE: ${{ 'divik/__init__.py' }}
DOCKER_REPO: ${{ 'gmrukwa/divik' }}
IS_ALPHA: ${{ github.event_name == 'pull_request' }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ docker pull gmrukwa/divik
To install specific version, you can specify it in the command, e.g.:

```bash
docker pull gmrukwa/divik:2.3.18
docker pull gmrukwa/divik:2.3.19
```

## Python package
Expand All @@ -60,7 +60,7 @@ pip install divik
or any stable tagged version, e.g.:

```bash
pip install divik==2.3.18
pip install divik==2.3.19
```

If you want to have compatibility with
Expand Down
2 changes: 1 addition & 1 deletion divik/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '2.3.18'
__version__ = '2.3.19'

from divik import core
from divik import feature_selection
Expand Down
3 changes: 2 additions & 1 deletion divik/_cli/_data_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def _load_mat(path: str) -> np.ndarray:
return _load_mat_with(path, backend=scio.loadmat, ignore='__')
except NotImplementedError: # v7.3 MATLAB HDF5 MAT-File
logging.debug('Legacy MAT-file loader failed, restarting with HDF5 loader.')
return _load_mat_with(path, backend=h5py.File, ignore='#').T
hdf5 = partial(h5py.File, mode='r')
return _load_mat_with(path, backend=hdf5, ignore='#').T


def _load_disk_file(path: str) -> u.Data:
Expand Down
37 changes: 27 additions & 10 deletions divik/_cli/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,39 @@ def prepare_destination(destination: str, omit_datetime: bool = False) -> str:
return destination


def setup_logger(destination: str, verbose: bool = False):
_PRECISE_FORMAT = '%(asctime)s [%(levelname)s] %(filename)40s:%(lineno)3s' \
+ ' - %(funcName)40s\t%(message)s'
_INFO_FORMAT = '%(asctime)s [%(levelname)s]\t%(message)s'


def _file_handler(destination: str):
log_destination = os.path.join(destination, 'logs.txt')
handler = logging.FileHandler(filename=log_destination, mode='a')
handler.setLevel(logging.DEBUG)
handler.setFormatter(logging.Formatter(_PRECISE_FORMAT))
return handler


def _stream_handler(verbose: bool):
handler = logging.StreamHandler(tqdm.tqdm)
if verbose:
log_format = '%(asctime)s [%(levelname)s] %(filename)40s:%(lineno)3s' \
+ ' - %(funcName)40s\t%(message)s'
log_level = logging.DEBUG
handler.setLevel(logging.INFO)
handler.setFormatter(logging.Formatter(_INFO_FORMAT))
else:
log_format = '%(asctime)s [%(levelname)s]\t%(message)s'
log_level = logging.INFO
handler.setLevel(logging.CRITICAL)
handler.setFormatter(logging.Formatter(_INFO_FORMAT))
return handler


def setup_logger(destination: str, verbose: bool = False):
stream_handler = _stream_handler(verbose)
file_handler = _file_handler(destination)
handlers = [
logging.StreamHandler(tqdm.tqdm),
logging.FileHandler(filename=log_destination,
mode='a')
stream_handler,
file_handler,
]
del logging.root.handlers[:]
logging.basicConfig(format=log_format, level=log_level, handlers=handlers)
logging.basicConfig(level=logging.DEBUG, handlers=handlers)
version_notice = "Using " + sys.argv[0] + \
" (divik, version " + __version__ + ")"
logging.info(version_notice)
Expand Down
2 changes: 1 addition & 1 deletion divik/cluster/_divik/_dunn.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _recursive_selection(current_selection: np.ndarray, partition: np.ndarray,

# @gmrukwa: I could not find more readable solution than recursion for now.
def dunn_divik(data: Data, selection: np.ndarray,
fast_kmeans: DunnSearch, full_kmeans: GAPSearch,
fast_kmeans: GAPSearch, full_kmeans: DunnSearch,
feature_selector: StatSelector,
minimal_size: int, rejection_size: int, report: DivikReporter) \
-> Optional[DivikResult]:
Expand Down
5 changes: 4 additions & 1 deletion divik/feature_selection/_stat_selector_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import numpy as np
from sklearn.base import BaseEstimator
from sklearn.feature_selection._base import SelectorMixin
try:
from sklearn.feature_selection._base import SelectorMixin
except ImportError:
from sklearn.feature_selection.base import SelectorMixin


class StatSelectorMixin(SelectorMixin, metaclass=ABCMeta):
Expand Down
4 changes: 2 additions & 2 deletions docs/instructions/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To install latest stable version use::

To install specific version, you can specify it in the command, e.g.::

docker pull gmrukwa/divik:2.3.18
docker pull gmrukwa/divik:2.3.19

Python package
--------------
Expand All @@ -31,7 +31,7 @@ package::

or any stable tagged version, e.g.::

pip install divik==2.3.18
pip install divik==2.3.19

If you want to have compatibility with
`gin-config <https://github.com/google/gin-config>`_, you can install
Expand Down

0 comments on commit 7986212

Please sign in to comment.