Skip to content

Commit

Permalink
Merge pull request #25 from gmrukwa/develop
Browse files Browse the repository at this point in the history
Release 2.3.6
  • Loading branch information
gmrukwa committed Dec 23, 2019
2 parents 5bacfb8 + b559cfa commit bd67761
Show file tree
Hide file tree
Showing 20 changed files with 83 additions and 93 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-python-dist/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM spectreteam/python_msi:v5.0.0
FROM spectreteam/python_msi:v5.1.0.2019a.py37

RUN pip install --no-cache-dir --upgrade \
setuptools \
Expand Down
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: ${{ 5 }}
FIXUP: ${{ 6 }}
PACKAGE_INIT_FILE: ${{ 'divik/__init__.py' }}
DOCKER_REPO: ${{ 'gmrukwa/divik' }}
IS_ALPHA: ${{ github.event_name == 'pull_request' }}
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[![CodeFactor](https://www.codefactor.io/repository/github/gmrukwa/divik/badge)](https://www.codefactor.io/repository/github/gmrukwa/divik)
[![BCH compliance](https://bettercodehub.com/edge/badge/gmrukwa/divik?branch=master)](https://bettercodehub.com/)
[![Maintainability](https://api.codeclimate.com/v1/badges/4cf5d42d0a0076c38445/maintainability)](https://codeclimate.com/github/gmrukwa/divik/maintainability)
![](https://github.com/gmrukwa/divik/workflows/.github/workflows/push_images.yml/badge.svg)
![](https://github.com/gmrukwa/divik/workflows/.github/workflows/unittest.yml/badge.svg)
![](https://github.com/gmrukwa/divik/workflows/Build%20and%20push%20deployment%20images/badge.svg)
![](https://github.com/gmrukwa/divik/workflows/Run%20unit%20tests%20in%20MCR%20environment/badge.svg)
[![Documentation Status](https://readthedocs.org/projects/divik/badge/?version=latest)](https://divik.readthedocs.io/en/latest/?badge=latest)

# divik
Expand Down Expand Up @@ -40,26 +40,26 @@ docker pull gmrukwa/divik
To install specific version, you can specify it in the command, e.g.:

```bash
docker pull gmrukwa/divik:2.1.8
docker pull gmrukwa/divik:2.3.6
```

## Python package

Prerequisites for installation of base package:

- Python 3.5
- Python 3.5 / 3.6 / 3.7

These are required for using `divik` application and GMM-based filtering:

- [MATLAB Compiler Runtime](https://www.mathworks.com/products/compiler/matlab-runtime.html),
version 2016b or newer, installed to default path
- [compiled package with legacy code](https://github.com/spectre-team/matlab-legacy/releases/tag/legacy-v4.0.9)
- [compiled package with legacy code](https://github.com/spectre-team/matlab-legacy/releases/tag/legacy-v5.0.0)

Installation process may be clearer with insight into Docker images used for
application deployment:

- [`python_mcr` image](https://github.com/spectre-team/python_mcr) - installs
MCR r2016b onto Python 3.5 image
MCR r2019a onto Python 3.7 image
- [`python_msi` image](https://github.com/spectre-team/python_msi) - installs
compiled legacy code onto MCR image
- [`divik` image](https://github.com/spectre-team/spectre-divik/blob/master/dockerfile) -
Expand All @@ -75,7 +75,7 @@ pip install divik
or any stable tagged version, e.g.:

```bash
pip install divik==2.1.8
pip install divik==2.3.6
```

# References
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.5'
__version__ = '2.3.6'

from ._seeding import seeded
from ._utils import DivikResult
Expand Down
14 changes: 9 additions & 5 deletions divik/_matlab_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
import logging
import os
import platform
import warnings

import numpy as np


# noinspection SpellCheckingInspection
_MATLAB_SEARCH_PATHS = \
"/usr/local/MATLAB/MATLAB_Runtime/v91/runtime/glnxa64:" + \
"/usr/local/MATLAB/MATLAB_Runtime/v91/bin/glnxa64:" + \
"/usr/local/MATLAB/MATLAB_Runtime/v91/sys/os/glnxa64:" + \
"/usr/local/MATLAB/MATLAB_Runtime/v91/sys/opengl/lib/glnxa64:"
"/usr/local/MATLAB/MATLAB_Runtime/v96/runtime/glnxa64:" + \
"/usr/local/MATLAB/MATLAB_Runtime/v96/bin/glnxa64:" + \
"/usr/local/MATLAB/MATLAB_Runtime/v96/sys/os/glnxa64:" + \
"/usr/local/MATLAB/MATLAB_Runtime/v96/extern/bin/glnxa64:"


_local_system = platform.system()
Expand Down Expand Up @@ -82,7 +84,9 @@ def find_thresholds(values: np.ndarray, max_components: int = 10,
import MatlabAlgorithms.MsiAlgorithms
# noinspection PyPackageRequirements
import matlab
values = matlab.double([[element] for element in values.ravel()])
with warnings.catch_warnings():
warnings.simplefilter("ignore")
values = matlab.double([[element] for element in values.ravel()])
try:
thresholds = engine.fetch_thresholds(values,
'MaxComponents',
Expand Down
4 changes: 2 additions & 2 deletions divik/cluster/_kmeans/_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def predict(self, X):
labels : array, shape [n_samples,]
Index of the cluster each sample belongs to.
"""
check_is_fitted(self, 'best_')
check_is_fitted(self)
return self.best_.predict(X)

def transform(self, X):
Expand All @@ -238,5 +238,5 @@ def transform(self, X):
X transformed in the new space.
"""
check_is_fitted(self, 'best_')
check_is_fitted(self)
return self.best_.transform(X)
4 changes: 2 additions & 2 deletions divik/cluster/_kmeans/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def predict(self, X):
labels : array, shape [n_samples,]
Index of the cluster each sample belongs to.
"""
check_is_fitted(self, 'cluster_centers_')
check_is_fitted(self)
if self.normalize_rows:
X = normalize_rows(X)
labels = dst.cdist(
Expand All @@ -252,7 +252,7 @@ def transform(self, X):
X transformed in the new space.
"""
check_is_fitted(self, 'cluster_centers_')
check_is_fitted(self)
if self.normalize_rows:
X = normalize_rows(X)
return dst.cdist(X, self.cluster_centers_, self.distance)
3 changes: 3 additions & 0 deletions divik/cluster/_sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pandas as pd
import scipy.spatial.distance as dist
from sklearn.base import BaseEstimator, ClusterMixin, TransformerMixin
from sklearn.utils.validation import check_is_fitted
import tqdm

import divik.feature_selection as fs
Expand Down Expand Up @@ -412,6 +413,7 @@ def transform(self, X):
X_new : array, shape [n_samples, self.n_clusters_]
X transformed in the new space.
"""
check_is_fitted(self)
if self._needs_normalization():
X = normalize_rows(X)
distances = np.hstack([
Expand Down Expand Up @@ -440,6 +442,7 @@ def predict(self, X):
labels : array, shape [n_samples,]
Index of the cluster each sample belongs to.
"""
check_is_fitted(self)
if self._needs_normalization():
X = normalize_rows(X)
n_jobs = get_n_jobs(self.n_jobs)
Expand Down
2 changes: 1 addition & 1 deletion divik/feature_extraction/_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def save(self, destination: str):
Directory to save the embedding.
"""
logging.info('Saving embedding to {0}.'.format(destination))
check_is_fitted(self, 'embedding_')
check_is_fitted(self)
from functools import partial
import os
import pickle
Expand Down
2 changes: 1 addition & 1 deletion divik/feature_selection/_specialized.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.feature_selection.base import SelectorMixin
from ._stat_selector_mixin import SelectorMixin
from ._gmm_selector import GMMSelector
from ._outlier import OutlierSelector
from ._percentage_selector import PercentageSelector
Expand Down
2 changes: 1 addition & 1 deletion divik/feature_selection/_stat_selector_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import numpy as np
from sklearn.base import BaseEstimator
from sklearn.feature_selection.base import SelectorMixin
from sklearn.feature_selection._base import SelectorMixin


class StatSelectorMixin(SelectorMixin, metaclass=ABCMeta):
Expand Down
2 changes: 1 addition & 1 deletion docker/deploy.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM spectreteam/python_msi:v5.0.0
FROM spectreteam/python_msi:v5.1.0.2019a.py37

ENV PYTHONUNBUFFERED TRUE

Expand Down
2 changes: 1 addition & 1 deletion docker/development.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM spectreteam/python_msi:v5.0.0
FROM spectreteam/python_msi:v5.1.0.2019a.py37

ENV PYTHONUNBUFFERED TRUE

Expand Down
2 changes: 1 addition & 1 deletion docker/docs.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM spectreteam/python_msi:v5.0.0
FROM spectreteam/python_msi:v5.1.0.2019a.py37

COPY requirements.txt /requirements.txt

Expand Down
2 changes: 1 addition & 1 deletion docker/unittest.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM spectreteam/python_msi:v5.0.0
FROM spectreteam/python_msi:v5.1.0.2019a.py37

ENV PYTHONUNBUFFERED TRUE

Expand Down
4 changes: 2 additions & 2 deletions docs/instructions/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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.5
docker pull gmrukwa/divik:2.3.6

Python package
--------------
Expand Down Expand Up @@ -43,4 +43,4 @@ package::

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

pip install divik==2.3.5
pip install divik==2.3.6
2 changes: 1 addition & 1 deletion docs/instructions/simple_windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ This is the simplest instruction to run DiviK on Windows.
#. Adjust the configuration to your needs

.. note:: Configuration follows the JSON format with fields defined as
``here <https://github.com/gmrukwa/divik/blob/master/divik/_cli/divik.md>`_.
`here <https://github.com/gmrukwa/divik/blob/master/divik/_cli/divik.md>`_.

#. Double click the ``run_divik.bat``
23 changes: 11 additions & 12 deletions requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ dash-html-components==0.13.4
dash-core-components==0.42.0
dash-renderer==0.17.0
dash-table==3.1.11
h5py==2.8.0
matplotlib==2.2.2
networkx==2.1
numpy==1.15.2
pandas==0.20.3
pyamg==4.0.0
scikit-image==0.14.1
scikit-learn==0.19.1
scipy==1.1.0
statsmodels==0.10.2
tqdm==4.11.2
typing==3.6.2; python_version=='3.4'
h5py
matplotlib
networkx
numpy
pandas
pyamg
scikit-image
scikit-learn
scipy
statsmodels
tqdm
83 changes: 33 additions & 50 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,64 +1,47 @@
appdirs==1.4.3
atomicwrites==1.3.0
attrs==18.2.0
certifi==2018.11.29
chardet==3.0.4
attrs==19.3.0
Click==7.0
cloudpickle==0.7.0
cycler==0.10.0
dash==0.34.0
dash-core-components==0.42.0
dash-html-components==0.13.4
dash-renderer==0.17.0
dash-table==3.1.11
dask==1.1.1
decorator==4.3.2
Flask==1.0.2
decorator==4.4.1
Flask==1.1.1
Flask-Compress==1.4.0
future==0.17.1
h5py==2.8.0
idna==2.8
ipython-genutils==0.2.0
imageio==2.6.1
importlib-metadata==1.3.0
itsdangerous==1.1.0
Jinja2==2.10
jsonschema==2.6.0
jupyter-core==4.4.0
kiwisolver==1.0.1
MarkupSafe==1.1.0
matplotlib==2.2.2
more-itertools==5.0.0
nbformat==4.4.0
networkx==2.1
numpy==1.15.2
packaging==19.0
pandas==0.20.3
pathlib2==2.3.3
Jinja2==2.10.3
joblib==0.14.1
kiwisolver==1.1.0
MarkupSafe==1.1.1
matplotlib==3.1.2
more-itertools==8.0.2
networkx==2.4
numpy==1.18.0
packaging==19.2
pandas==0.25.3
patsy==0.5.1
Pillow==5.4.1
plotly==3.6.0
pluggy==0.8.1
py==1.7.0
Pillow==6.2.1
plotly==4.4.1
pluggy==0.13.1
py==1.8.0
pyamg==4.0.0
pyarrow==0.12.0
pybind11==2.2.4
pyparsing==2.3.1
pytest==4.2.0
python-dateutil==2.8.0
pytz==2018.9
PyWavelets==1.0.1
PyYAML==3.13
quilt==2.9.12
requests==2.21.0
pybind11==2.4.3
pyparsing==2.4.5
pytest==5.3.2
python-dateutil==2.8.1
pytz==2019.3
PyWavelets==1.1.1
retrying==1.3.3
scikit-image==0.14.1
scikit-learn==0.19.1
scipy==1.1.0
six==1.12.0
scikit-image==0.16.2
scikit-learn==0.22
scipy==1.4.1
six==1.13.0
statsmodels==0.10.2
toolz==0.9.0
tqdm==4.11.2
traitlets==4.3.2
typing==3.6.6
urllib3==1.24.1
Werkzeug==0.14.1
xlrd==1.2.0
tqdm==4.41.0
wcwidth==0.1.7
Werkzeug==0.16.0
zipp==0.6.0
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
author_email='g.mrukwa@gmail.com',
classifiers=[
# based on https://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 3 - Alpha',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Scientific/Engineering :: Information Analysis',
Expand Down

0 comments on commit bd67761

Please sign in to comment.