-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests added and updated, unnecessary memory usage removed
- Loading branch information
1 parent
b64445a
commit de8b1bb
Showing
3 changed files
with
20 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from unittest import TestCase | ||
from niaaml.preprocessing.feature_selection import ParticleSwarmOptimization, SelectKBest | ||
from niaaml.data import CSVDataReader | ||
import os | ||
|
||
class FeatureSelectionTestCase(TestCase): | ||
def setUp(self): | ||
self.__algo1 = ParticleSwarmOptimization() | ||
self.__algo2 = SelectKBest() | ||
|
||
def test_select_features_works_fine(self): | ||
data_reader = CSVDataReader(src=os.path.dirname(os.path.abspath(__file__)) + '/tests_files/dataset_header_classes.csv', has_header=True, contains_classes=True) | ||
|
||
selected_features_mask = self.__algo1.select_features(data_reader.get_x(), data_reader.get_y()) | ||
self.assertEqual(data_reader.get_x().shape[1], len(selected_features_mask)) | ||
|
||
selected_features_mask = self.__algo2.select_features(data_reader.get_x(), data_reader.get_y()) | ||
self.assertEqual(data_reader.get_x().shape[1], len(selected_features_mask)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters