Repository: skekre98/simple_learn (language: python)

Issue:
Add unique test cases to SimpleClassifierList
**Description of feature/enhancement**
Currently `SimpleClassifierList` is only being tested against two different datasets, wine and iris. It would be a good idea to verify this class against more datasets.  

**Description of implementation**
Add the test cases to the `TestSimpleClassifierList` class:
https://github.com/skekre98/simple_learn/blob/953150faecf12951407e2aed3418fd139b0ab9ed/tests/classifiers/simple_classifier_list_tests.py#L33

Recommended to use pre-wrangled datasets such as those available in `sklearn`.

**Why this is a good feature/enhancement**
Will allow us to verify the class against a wider variety of datasets.

**Additional context**
In the future might be nice to create in house datasets for testing.


Discussion / hints:
Hi

I would like to help you by contributing a few tests. 
I noticed a bug in `def_test_iris` : 

```
def test_iris(self):

        iris = datasets.load_wine()
```

you load wine instead of iris dataset if I got it right.


Hi @eranns, you are absolutely right. This is indeed a bug, that line should read `iris = datasets.load_iris()`.  Thanks for catching that! I'll go ahead and assign the issue over to you 😄 . Can you also fix the iris dataset in your PR as well?
Yes sure

Fix patch:
diff --git a/README.md b/README.md
index cfb5e9a..f755c6c 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 <p align="center">
     <img src="/img/logo.png">
-</p> 
+</p>
 
 [![Python](https://img.shields.io/pypi/pyversions/simple-learn.svg?style=plastic)](https://badge.fury.io/py/simple-learn)
 [![PyPI version shields.io](https://img.shields.io/pypi/v/simple-learn.svg?kill_cache=1)](https://pypi.python.org/pypi/simple-learn/)


Test patch:
diff --git a/tests/classifiers/simple_classifier_list_tests.py b/tests/classifiers/simple_classifier_list_tests.py
index fb9d249..d09fb28 100644
--- a/tests/classifiers/simple_classifier_list_tests.py
+++ b/tests/classifiers/simple_classifier_list_tests.py
@@ -24,6 +24,7 @@
 warnings.filterwarnings("ignore")
 
 from sklearn import datasets
+from sklearn.feature_extraction.text import TfidfVectorizer
 from sklearn.metrics import accuracy_score
 from sklearn.model_selection import train_test_split
 
@@ -49,7 +50,7 @@ def test_wine(self):
         self.assertTrue(accuracy_score(true_y, pred1_y) > 0.90)
 
     def test_iris(self):
-        iris = datasets.load_wine()
+        iris = datasets.load_iris()
         true_x = iris.data
         true_y = iris.target
 
@@ -65,6 +66,40 @@ def test_iris(self):
         self.assertTrue(accuracy_score(true_y, pred0_y) > 0.95)
         self.assertTrue(accuracy_score(true_y, pred1_y) > 0.90)
 
+    def test_digits(self):
+        digits = datasets.load_digits()
+        true_x = digits.data
+        true_y = digits.target
+
+        clf_list = SimpleClassifierList()
+        clf_list.fit(true_x, true_y)
+        self.assertTrue(len(clf_list.ranked_list) > 0)
+
+        clf1 = clf_list.pop(1)
+        clf0 = clf_list.pop()
+
+        pred1_y = clf1.predict(true_x)
+        pred0_y = clf0.predict(true_x)
+        self.assertTrue(accuracy_score(true_y, pred0_y) > 0.95)
+        self.assertTrue(accuracy_score(true_y, pred1_y) > 0.90)
+
+    def test_breast_cancer(self):
+        breast_cancer_data = datasets.load_breast_cancer()
+        true_x = breast_cancer_data.data
+        true_y = breast_cancer_data.target
+
+        clf_list = SimpleClassifierList()
+        clf_list.fit(true_x, true_y)
+        self.assertTrue(len(clf_list.ranked_list) > 0)
+
+        clf1 = clf_list.pop(1)
+        clf0 = clf_list.pop()
+
+        pred1_y = clf1.predict(true_x)
+        pred0_y = clf0.predict(true_x)
+        self.assertTrue(accuracy_score(true_y, pred0_y) > 0.95)
+        self.assertTrue(accuracy_score(true_y, pred1_y) > 0.90)
+
 
 if __name__ == "__main__":
     unittest.main()