Skip to content

Commit

Permalink
Merge pull request #45 from ealcobaca/0.1.x
Browse files Browse the repository at this point in the history
0.1.x
  • Loading branch information
ealcobaca authored Nov 27, 2019
2 parents ff39a53 + ed90974 commit 35235f1
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 55 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ You can find in the documentation interesting pages like:

## Developer notes

* We are glad to accept any contributions, please check [Contributing](CONTRIVUTING.md) and the [Documentation](https://pymfe.readthedocs.io/en/latest/?badge=latest).
* We are glad to accept any contributions, please check [Contributing](https://github.com/ealcobaca/pymfe/blob/master/CONTRIBUTING.md) and the [Documentation](https://pymfe.readthedocs.io/en/latest/?badge=latest).
* To submit bugs and feature requests, report at [project issues](https://github.com/ealcobaca/pymfe/issues).
* In the current version, the meta-feature extractor supports only classification problems. The authors plan to extend the package to add clustering and regression measures and to support MtL evaluation measures. For more specific information on how to extract each group of measures, please refer to the functions documentation page and the examples contained therein. For a general overview of the `pymfe` package, please have a look at the associated documentation.

Expand Down
83 changes: 59 additions & 24 deletions docs/source/new.rst
Original file line number Diff line number Diff line change
@@ -1,41 +1,76 @@
What is new on pymfe package?
#############################

Version 0.1.1
-------------
* Bugs solved

* False positive of mypy fixed

* Contributing link now is working

* We added a note about how to add a new meta-feature

* Modified 'verbosity' (from 'extract' method) argument type from boolean to
integer. Now the user can choose the desired level of verbosity.
Verbosity = 1 means that a progress bar will be shown during the metafeature
extraction process. Verbosity = 2 maintains all the previous verbose messages
(i.e., it logs every "extract" step) plus additional information about the
current percentage of progress done so far.


Version 0.1.0
-------------
- Meta-feature groups available:
- Relative landmarking
- Clustering-based
- Relative subsampling landmarking
- Makefile to help developers
* Meta-feature groups available

* Relative landmarking

* Clustering-based

* Relative subsampling landmarking

* Makefile to help developers

* New Functionalities

* Now you can list available groups

- New Functionalities
- Now you can list available groups
- Now you can list available metafeatures
* Now you can list available metafeatures

- Documentation
- New examples
- New README
* Documentation

- Bugs
- Problems in parse categoric metafeatures solved
- Categorization of attributes with constant values solved
* New examples

- Test
- Several new tests added
* New README

* Bugs

* Problems in parse categoric metafeatures solved

* Categorization of attributes with constant values solved

* Test

* Several new tests added

Version 0.0.3
-------------
- Documentation improvement
- Setup improvement
* Documentation improvement

* Setup improvement


Initial Release
---------------
- Meta-feature groups available:
- Simple
- Statistical
- Information-theoretic
- Model-based
- Landmarking
* Meta-feature groups available:

* Simple

* Statistical

* Information-theoretic

* Model-based

* Landmarking

Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
from sklearn.datasets import load_iris
from pymfe.mfe import MFE

data = load_iris()
y = data.target
X = data.data

###############################################################################
# Print all available metafeature groups from the ``pymfe`` package.
model = MFE()
Expand Down
26 changes: 26 additions & 0 deletions examples/03_miscellaneous_examples/plot_metafeature_description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""
Metafeature description
=======================
In this example, we will show you how to list the types of metafeatures,
groups, and summaries available.
"""

from pymfe.mfe import MFE


###############################################################################
# This function shows the description of all metafeatures.
MFE.metafeature_description()

###############################################################################
# You can select a specific group.
MFE.metafeature_description(groups=["general", "statistical"])

###############################################################################
# You can sort the metafeatures by name.
MFE.metafeature_description(sort=True)

###############################################################################
# You also can get the table instead of printing it.
MFE.metafeature_description(print_table=False)
38 changes: 37 additions & 1 deletion pymfe/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@

VALID_VALUE_PREFIX = "VALID_"

DEFAULT_GROUP = (
"general",
"info-theory",
"statistical",
"model-based",
"landmarking",
) # type: t.Tuple[str, ...]

VALID_GROUPS = (
"landmarking",
"general",
Expand Down Expand Up @@ -243,7 +251,6 @@ def _check_values_in_group(value: t.Union[str, t.Iterable[str]],
value_set = set(map(str.lower, value))
if wildcard and wildcard.lower() in value_set:
in_group = tuple(valid_group)

else:
in_group = tuple(value_set.intersection(valid_group))
not_in_group = tuple(value_set.difference(valid_group))
Expand Down Expand Up @@ -639,10 +646,32 @@ def check_summary_warnings(value: t.Union[TypeNumeric, t.Sequence, np.ndarray],
RuntimeWarning)


def convert_alias(groups_alias: t.Iterable[t.Iterable],
values: t.Optional[t.Union[t.Iterable[str], str]] = None
) -> t.List[str]:
"""Change the values of the alias to the groups.
"""
if not values:
values = []
elif isinstance(values, str):
values = [values]
else:
values = list(values)

for alias_name, alias_value in groups_alias:
# verifying if the alias is in the set
if alias_name in values:
values.remove(alias_name) # remove from values
values = list(values) + list(alias_value) # add real groups

return values


def process_generic_set(
values: t.Optional[t.Union[t.Iterable[str], str]],
group_name: str,
wildcard: t.Optional[str] = "all",
groups_alias: t.Iterable[t.Iterable] = None,
allow_none: bool = False,
allow_empty: bool = False,
) -> t.Tuple[str, ...]:
Expand All @@ -660,6 +689,10 @@ def process_generic_set(
out its prefix. For example, to select ``VALID_CLASSES`` group for
``values`` reference, then group_names must be just ``classes``.
groups_alias (:obj:`iterable` of :obj:`iterable`): a list of tuples of
aliases. Each tuple should have in the alias name in the first
position and the real groups mapped int he second position.
wildcard (:obj:`str`, optional): special value to ``accept any value``.
allow_none (:obj:`bool`, optional): if True, then :obj:`NoneType` is
Expand Down Expand Up @@ -722,6 +755,9 @@ def process_generic_set(
"module documentation to verify which ones "
"are available for use.".format(group_name))

if groups_alias:
values = convert_alias(groups_alias, values)

in_valid_set, not_in_valid_set = _check_values_in_group(
value=values,
valid_group=valid_values,
Expand Down
2 changes: 1 addition & 1 deletion pymfe/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'


__version__ = '0.1.0'
__version__ = '0.1.1'
9 changes: 9 additions & 0 deletions pymfe/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,19 @@
>>> make code-check
.. note::
This example shows how to create a new group of meta-features. If you want
only to add a new meta-feature, you should insert it in the meta-feature
group file and create an "ft_" method to it. The new meta-feature will be
automatically picked up (as the method "ft_foo" in this example). You
should not forget to use the precompute methods to save time.
.. note::
You should not forget to create tests for all new functionalities that
you implemented. The test can be found in `./tests/` fold.
.. note::
This class is being actualized in GitHub, check this
`link <https://github.com/ealcobaca/pymfe/blob/master/pymfe/dev.py>`_
Expand Down
Loading

0 comments on commit 35235f1

Please sign in to comment.