-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Py Version and Fix text based tests (#16)
- Loading branch information
Showing
5 changed files
with
76 additions
and
67 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
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
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,29 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright FMR LLC <[email protected]> | ||
# SPDX-License-Identifier: GNU GPLv3 | ||
|
||
import numpy as np | ||
from sklearn.datasets import load_iris | ||
from feature.utils import get_data_label, reduce_memory, DataTransformer | ||
|
||
from tests.test_base import BaseTest | ||
|
||
|
||
class TestUtils(BaseTest): | ||
|
||
def test_mem_usage(self): | ||
data, label = get_data_label(load_iris()) | ||
data_reduced = reduce_memory(data, verbose=False) | ||
self.assertEqual(data_reduced.shape, (150, 4)) | ||
self.assertFalse(data_reduced.isna().any().any()) | ||
|
||
def test_cap_floor(self): | ||
data, label = get_data_label(load_iris()) | ||
|
||
# Fit transformer and transform to numeric contexts | ||
data_transformer = DataTransformer() | ||
contexts = data_transformer.fit(data) | ||
contexts = data_transformer.transform(data) | ||
contexts = data_transformer.fit_transform(data) | ||
self.assertFalse(np.isnan(contexts).any()) | ||
self.assertEqual(contexts.shape, (150, 4)) |