Skip to content

Commit 35235f1

Browse files
authored
Merge pull request #45 from ealcobaca/0.1.x
0.1.x
2 parents ff39a53 + ed90974 commit 35235f1

File tree

10 files changed

+261
-55
lines changed

10 files changed

+261
-55
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ You can find in the documentation interesting pages like:
112112

113113
## Developer notes
114114

115-
* We are glad to accept any contributions, please check [Contributing](CONTRIVUTING.md) and the [Documentation](https://pymfe.readthedocs.io/en/latest/?badge=latest).
115+
* 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).
116116
* To submit bugs and feature requests, report at [project issues](https://github.com/ealcobaca/pymfe/issues).
117117
* 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.
118118

docs/source/new.rst

Lines changed: 59 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,76 @@
11
What is new on pymfe package?
22
#############################
33

4+
Version 0.1.1
5+
-------------
6+
* Bugs solved
7+
8+
* False positive of mypy fixed
9+
10+
* Contributing link now is working
11+
12+
* We added a note about how to add a new meta-feature
13+
14+
* Modified 'verbosity' (from 'extract' method) argument type from boolean to
15+
integer. Now the user can choose the desired level of verbosity.
16+
Verbosity = 1 means that a progress bar will be shown during the metafeature
17+
extraction process. Verbosity = 2 maintains all the previous verbose messages
18+
(i.e., it logs every "extract" step) plus additional information about the
19+
current percentage of progress done so far.
20+
421

522
Version 0.1.0
623
-------------
7-
- Meta-feature groups available:
8-
- Relative landmarking
9-
- Clustering-based
10-
- Relative subsampling landmarking
11-
- Makefile to help developers
24+
* Meta-feature groups available
25+
26+
* Relative landmarking
27+
28+
* Clustering-based
29+
30+
* Relative subsampling landmarking
31+
32+
* Makefile to help developers
33+
34+
* New Functionalities
35+
36+
* Now you can list available groups
1237

13-
- New Functionalities
14-
- Now you can list available groups
15-
- Now you can list available metafeatures
38+
* Now you can list available metafeatures
1639

17-
- Documentation
18-
- New examples
19-
- New README
40+
* Documentation
2041

21-
- Bugs
22-
- Problems in parse categoric metafeatures solved
23-
- Categorization of attributes with constant values solved
42+
* New examples
2443

25-
- Test
26-
- Several new tests added
44+
* New README
45+
46+
* Bugs
47+
48+
* Problems in parse categoric metafeatures solved
49+
50+
* Categorization of attributes with constant values solved
51+
52+
* Test
53+
54+
* Several new tests added
2755

2856
Version 0.0.3
2957
-------------
30-
- Documentation improvement
31-
- Setup improvement
58+
* Documentation improvement
59+
60+
* Setup improvement
3261

3362

3463
Initial Release
3564
---------------
36-
- Meta-feature groups available:
37-
- Simple
38-
- Statistical
39-
- Information-theoretic
40-
- Model-based
41-
- Landmarking
65+
* Meta-feature groups available:
66+
67+
* Simple
68+
69+
* Statistical
70+
71+
* Information-theoretic
72+
73+
* Model-based
74+
75+
* Landmarking
76+

examples/03_miscellaneous_examples/plot_listing_metafeatures_groups.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
from sklearn.datasets import load_iris
1010
from pymfe.mfe import MFE
1111

12-
data = load_iris()
13-
y = data.target
14-
X = data.data
15-
1612
###############################################################################
1713
# Print all available metafeature groups from the ``pymfe`` package.
1814
model = MFE()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
Metafeature description
3+
=======================
4+
5+
In this example, we will show you how to list the types of metafeatures,
6+
groups, and summaries available.
7+
"""
8+
9+
from pymfe.mfe import MFE
10+
11+
12+
###############################################################################
13+
# This function shows the description of all metafeatures.
14+
MFE.metafeature_description()
15+
16+
###############################################################################
17+
# You can select a specific group.
18+
MFE.metafeature_description(groups=["general", "statistical"])
19+
20+
###############################################################################
21+
# You can sort the metafeatures by name.
22+
MFE.metafeature_description(sort=True)
23+
24+
###############################################################################
25+
# You also can get the table instead of printing it.
26+
MFE.metafeature_description(print_table=False)

pymfe/_internal.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@
8686

8787
VALID_VALUE_PREFIX = "VALID_"
8888

89+
DEFAULT_GROUP = (
90+
"general",
91+
"info-theory",
92+
"statistical",
93+
"model-based",
94+
"landmarking",
95+
) # type: t.Tuple[str, ...]
96+
8997
VALID_GROUPS = (
9098
"landmarking",
9199
"general",
@@ -243,7 +251,6 @@ def _check_values_in_group(value: t.Union[str, t.Iterable[str]],
243251
value_set = set(map(str.lower, value))
244252
if wildcard and wildcard.lower() in value_set:
245253
in_group = tuple(valid_group)
246-
247254
else:
248255
in_group = tuple(value_set.intersection(valid_group))
249256
not_in_group = tuple(value_set.difference(valid_group))
@@ -639,10 +646,32 @@ def check_summary_warnings(value: t.Union[TypeNumeric, t.Sequence, np.ndarray],
639646
RuntimeWarning)
640647

641648

649+
def convert_alias(groups_alias: t.Iterable[t.Iterable],
650+
values: t.Optional[t.Union[t.Iterable[str], str]] = None
651+
) -> t.List[str]:
652+
"""Change the values of the alias to the groups.
653+
"""
654+
if not values:
655+
values = []
656+
elif isinstance(values, str):
657+
values = [values]
658+
else:
659+
values = list(values)
660+
661+
for alias_name, alias_value in groups_alias:
662+
# verifying if the alias is in the set
663+
if alias_name in values:
664+
values.remove(alias_name) # remove from values
665+
values = list(values) + list(alias_value) # add real groups
666+
667+
return values
668+
669+
642670
def process_generic_set(
643671
values: t.Optional[t.Union[t.Iterable[str], str]],
644672
group_name: str,
645673
wildcard: t.Optional[str] = "all",
674+
groups_alias: t.Iterable[t.Iterable] = None,
646675
allow_none: bool = False,
647676
allow_empty: bool = False,
648677
) -> t.Tuple[str, ...]:
@@ -660,6 +689,10 @@ def process_generic_set(
660689
out its prefix. For example, to select ``VALID_CLASSES`` group for
661690
``values`` reference, then group_names must be just ``classes``.
662691
692+
groups_alias (:obj:`iterable` of :obj:`iterable`): a list of tuples of
693+
aliases. Each tuple should have in the alias name in the first
694+
position and the real groups mapped int he second position.
695+
663696
wildcard (:obj:`str`, optional): special value to ``accept any value``.
664697
665698
allow_none (:obj:`bool`, optional): if True, then :obj:`NoneType` is
@@ -722,6 +755,9 @@ def process_generic_set(
722755
"module documentation to verify which ones "
723756
"are available for use.".format(group_name))
724757

758+
if groups_alias:
759+
values = convert_alias(groups_alias, values)
760+
725761
in_valid_set, not_in_valid_set = _check_values_in_group(
726762
value=values,
727763
valid_group=valid_values,

pymfe/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
2323

2424

25-
__version__ = '0.1.0'
25+
__version__ = '0.1.1'

pymfe/dev.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,19 @@
9191
9292
>>> make code-check
9393
94+
.. note::
95+
This example shows how to create a new group of meta-features. If you want
96+
only to add a new meta-feature, you should insert it in the meta-feature
97+
group file and create an "ft_" method to it. The new meta-feature will be
98+
automatically picked up (as the method "ft_foo" in this example). You
99+
should not forget to use the precompute methods to save time.
100+
101+
94102
.. note::
95103
You should not forget to create tests for all new functionalities that
96104
you implemented. The test can be found in `./tests/` fold.
97105
106+
98107
.. note::
99108
This class is being actualized in GitHub, check this
100109
`link <https://github.com/ealcobaca/pymfe/blob/master/pymfe/dev.py>`_

0 commit comments

Comments
 (0)