Skip to content

Commit

Permalink
Merge pull request #113 from ealcobaca/code-maintenance
Browse files Browse the repository at this point in the history
Full code maintenance
  • Loading branch information
ealcobaca committed Mar 7, 2021
2 parents 29e3527 + d1de0d9 commit b454f8a
Show file tree
Hide file tree
Showing 24 changed files with 434 additions and 426 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"

install:
- make install-dev
Expand All @@ -25,8 +26,8 @@ env:
#
script:
- mypy $SOURCE_FILES --ignore-missing-imports
- pylint $SOURCE_FILES -d 'C0103, R0913, R0902, R0914, C0302, R0904, R0801, E1101, C0330'
- pytest tests/ --showlocals -v --cov=pymfe/
- pylint $SOURCE_FILES -j 0 -d 'C0103, R0913, R0902, R0914, C0302, R0904, R0801, E1101, C0330, E1136'
- pytest tests/ -n auto --showlocals -v --cov=pymfe/
- make html

notifications:
Expand Down
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PACKAGE := pymfe
TEST_NCORES := auto

all: clean install-dev code-check test-cov
.PHONY: all clean test test-cov code-check pypi install install-dev html help h t c cl
Expand All @@ -16,17 +17,20 @@ clean: ## Clean all undesired files such as .so, .pyc, build files and etc.
cl: clean ## Shortcut to clean

test: ## Execute the code test using pytest.
pytest tests/
pytest -n $(TEST_NCORES) tests/

test-cov: ## Execute the code test using pytest and measuring the coverage.
rm -rf coverage .coverage
pytest --cov=$(PACKAGE)/ tests/
pytest -n $(TEST_NCORES) --cov=$(PACKAGE)/ tests/

t: test-cov ## Shortcut to test-cov

code-check: ## Execute the code check with flake8, pylint, mypy.
flake8 $(PACKAGE)
pylint $(PACKAGE) -d 'C0103, R0913, R0902, R0914, C0302, R0904, R0801, E1101, C0330'
pylint $(PACKAGE) -j 0 -d 'C0103, R0913, R0902, R0914, C0302, R0904, R0801, E1101, C0330, E1136'
mypy $(PACKAGE) --ignore-missing-imports

type-check: ## Execute the code check with mypy only.
mypy $(PACKAGE) --ignore-missing-imports

c: code-check # Shortcut to code-check
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,24 @@ ft = mfe.extract()
print(ft)
```

You can easily list all available metafeature groups, metafeatures, summary
methods and metafeatures filtered by groups of interest:
```python
from pymfe.mfe import MFE

# Check all available meta-feature groups in the package
print(MFE.valid_groups())

# Check all available meta-features in the package
print(MFE.valid_metafeatures())

# Check available meta-features filtering by groups of interest
print(MFE.valid_metafeatures(groups=["general", "statistical", "info-theory"]))

# Check all available summary functions in the package
print(MFE.valid_summary())
```

It is possible to pass custom arguments to every metafeature using `MFE`
`extract` method kwargs. The keywords must be the target metafeature name, and
the value must be a dictionary in the format {`argument`: `value`}, i.e., each
Expand Down
9 changes: 6 additions & 3 deletions pymfe/_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,10 @@ def ft_using_precomputed_values(
return res

@classmethod
def ft_about_return_values(cls, y: np.ndarray,) -> np.ndarray:
def ft_about_return_values(
cls,
y: np.ndarray,
) -> np.ndarray:
"""Information about return values of feature extraction methods.
1. You have two return options for metafeature extraction methods
Expand Down Expand Up @@ -949,7 +952,7 @@ def postprocess_groupName1_groupName2(
mtf_names: t.List[str],
mtf_vals: t.List[float],
mtf_time: t.List[float],
class_indexes: t.Sequence[int],
class_indexes: t.List[int],
groups: t.Tuple[str, ...],
inserted_group_dep: t.FrozenSet[str],
**kwargs
Expand Down Expand Up @@ -1048,7 +1051,7 @@ def postprocess_groupName1_groupName2(
A list containing all time elapsed for each metafeature
previously extracted.
class_indexes : Sequence of int
class_indexes : List of int
Indexes of the metafeatures related to this method ``groups of
interest``. The ``groups of interest`` are the metafeature groups
whose name are in this method's name after the ``postprocess_``
Expand Down

0 comments on commit b454f8a

Please sign in to comment.