Skip to content

Commit

Permalink
readme updated, factory class updated
Browse files Browse the repository at this point in the history
  • Loading branch information
lukapecnik committed Dec 4, 2020
1 parent 8d0ef92 commit cc4326a
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

NiaAML is an automated machine learning Python framework based on nature-inspired algorithms for optimization. The name comes from the automated machine learning method of the same name [[1]](#1). Its goal is to efficiently compose the best possible classification pipeline for the given task using components on the input. The components are divided into three groups: feature seletion algorithms, feature transformation algorithms and classifiers. The framework uses nature-inspired algorithms for optimization to choose the best set of components for the classification pipeline on the output and optimize their parameters. We use <a href="https://github.com/NiaOrg/NiaPy">NiaPy framework</a> for the optimization process which is a popular Python collection of nature-inspired algorithms. The NiaAML framework is easy to use and customize or expand to suit your needs.

The NiaAML framework allows you not only to run full pipeline optimization, but also separate implemented components such as classifiers, feature selection algorithms, etc. It currently supports only numeric features on the input. **However, we are planning to add support for categorical features too.** See the [examples](examples) for more information.
The NiaAML framework allows you not only to run full pipeline optimization, but also separate implemented components such as classifiers, feature selection algorithms, etc. It currently supports only numeric features on the input. **However, we are planning to add support for categorical features too.**

* **Free software:** MIT license
* **Documentation:** https://niaaml.readthedocs.io/en/latest/
Expand Down
2 changes: 1 addition & 1 deletion niaaml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
]

__project__ = 'niaaml'
__version__ = '0.1.3a1'
__version__ = '0.1.3'
12 changes: 11 additions & 1 deletion niaaml/tests/test_classifier_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,14 @@ def test_get_result_works_fine(self):
self.assertIsInstance(instance, Classifier)

with self.assertRaises(TypeError):
self.__factory.get_result('non_existent_name')
self.__factory.get_result('non_existent_name')

def test_get_dictionary_works_fine(self):
d = self.__factory.get_name_to_classname_mapping()
d_keys = d.keys()
e_keys = self.__factory._entities.keys()

self.assertEqual(len(e_keys), len(d_keys))

for k in d:
self.assertIsNotNone(d[k])
12 changes: 11 additions & 1 deletion niaaml/tests/test_feature_selection_algorithm_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,14 @@ def test_get_result_works_fine(self):
self.assertIsInstance(instance, FeatureSelectionAlgorithm)

with self.assertRaises(TypeError):
self.__factory.get_result('non_existent_name')
self.__factory.get_result('non_existent_name')

def test_get_dictionary_works_fine(self):
d = self.__factory.get_name_to_classname_mapping()
d_keys = d.keys()
e_keys = self.__factory._entities.keys()

self.assertEqual(len(e_keys), len(d_keys))

for k in d:
self.assertIsNotNone(d[k])
12 changes: 11 additions & 1 deletion niaaml/tests/test_feature_transform_algorithm_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,14 @@ def test_get_result_works_fine(self):
self.assertIsInstance(instance, FeatureTransformAlgorithm)

with self.assertRaises(TypeError):
self.__factory.get_result('non_existent_name')
self.__factory.get_result('non_existent_name')

def test_get_dictionary_works_fine(self):
d = self.__factory.get_name_to_classname_mapping()
d_keys = d.keys()
e_keys = self.__factory._entities.keys()

self.assertEqual(len(e_keys), len(d_keys))

for k in d:
self.assertIsNotNone(d[k])
12 changes: 11 additions & 1 deletion niaaml/tests/test_fitness_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,14 @@ def test_get_result_works_fine(self):
self.assertIsInstance(instance, FitnessFunction)

with self.assertRaises(TypeError):
self.__factory.get_result('non_existent_name')
self.__factory.get_result('non_existent_name')

def test_get_dictionary_works_fine(self):
d = self.__factory.get_name_to_classname_mapping()
d_keys = d.keys()
e_keys = self.__factory._entities.keys()

self.assertEqual(len(e_keys), len(d_keys))

for k in d:
self.assertIsNotNone(d[k])
11 changes: 11 additions & 0 deletions niaaml/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ def get_result(self, name):
return self._entities[name]()
else:
raise TypeError('Passed entity is not defined! --> %s' % name)

def get_name_to_classname_mapping(self):
r"""Get dictionary of user-friendly name to class name mapping.
Returns:
dict: Dictionary of user-friendly name to class name mapping.
"""
d = {}
for k in self._entities:
d[self._entities[k].Name] = k
return d

class OptimizationStats:
r"""Class that holds pipeline optimization result's statistics. Includes accuracy, precision, Cohen's kappa and F1-score.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "NiaAML"
version = "0.1.3a1"
version = "0.1.3"
description = "Python automated machine learning framework."
license = "MIT"
authors = ["Luka Pečnik <lukapecnik96@gmail.com>", "Iztok Fister Jr. <iztok.fister1@um.si>"]
Expand Down

0 comments on commit cc4326a

Please sign in to comment.