-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make release-tag: Merge branch 'master' into stable
- Loading branch information
Showing
14 changed files
with
261 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
__author__ = """MIT Data To AI Lab""" | ||
__email__ = '[email protected]' | ||
__version__ = '0.5.1' | ||
__version__ = '0.5.2.dev1' | ||
|
||
import numpy as np | ||
import pandas as pd | ||
|
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,83 @@ | ||
import numpy as np | ||
import pandas as pd | ||
|
||
from rdt.transformers import BooleanTransformer | ||
|
||
|
||
class TestBooleanTransformer: | ||
|
||
def test_boolean_some_nans(self): | ||
"""Test BooleanTransformer on input with some nan values. | ||
Ensure that the BooleanTransformer can fit, transform, and reverse | ||
transform on boolean data with Nones. Expect that the reverse | ||
transformed data is the same as the input. | ||
Input: | ||
- boolean data with None values | ||
Output: | ||
- The reversed transformed data | ||
""" | ||
# Setup | ||
data = pd.Series([True, False, None, False]) | ||
transformer = BooleanTransformer() | ||
|
||
# Run | ||
transformer.fit(data) | ||
transformed = transformer.transform(data) | ||
reverse = transformer.reverse_transform(transformed) | ||
|
||
# Assert | ||
pd.testing.assert_series_equal(reverse, data) | ||
|
||
def test_boolean_all_nans(self): | ||
"""Test BooleanTransformer on input with all nan values. | ||
Ensure that the BooleanTransformer can fit, transform, and reverse | ||
transform on boolean data with all Nones. Expect that the reverse | ||
transformed data is the same as the input. | ||
Input: | ||
- 4 rows of all None values | ||
Output: | ||
- The reversed transformed data | ||
""" | ||
# Setup | ||
data = pd.Series([None, None, None, None]) | ||
transformer = BooleanTransformer() | ||
|
||
# Run | ||
transformer.fit(data) | ||
transformed = transformer.transform(data) | ||
reverse = transformer.reverse_transform(transformed) | ||
|
||
# Assert | ||
pd.testing.assert_series_equal(reverse, data) | ||
|
||
def test_boolean_input_unchanged(self): | ||
"""Test BooleanTransformer on input with some nan values. | ||
Ensure that the BooleanTransformer can fit, transform, and reverse | ||
transform on boolean data with all Nones. Expect that the intermediate | ||
transformed data is unchanged. | ||
Input: | ||
- 4 rows of all None values | ||
Output: | ||
- The reversed transformed data | ||
Side effects: | ||
- The intermediate transformed data is unchanged. | ||
""" | ||
# Setup | ||
data = pd.Series([True, False, None, False]) | ||
transformer = BooleanTransformer() | ||
|
||
# Run | ||
transformer.fit(data) | ||
transformed = transformer.transform(data) | ||
unchanged_transformed = transformed.copy() | ||
reverse = transformer.reverse_transform(transformed) | ||
|
||
# Assert | ||
pd.testing.assert_series_equal(reverse, data) | ||
np.testing.assert_array_equal(unchanged_transformed, transformed) |
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 |
---|---|---|
|
@@ -14,8 +14,8 @@ | |
"memory": 1000000.0 | ||
}, | ||
"reverse_transform": { | ||
"time": 0.003, | ||
"time": 0.01, | ||
"memory": 1000000.0 | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -17,8 +17,8 @@ | |
"memory": 1000000.0 | ||
}, | ||
"reverse_transform": { | ||
"time": 0.002, | ||
"time": 0.01, | ||
"memory": 500000.0 | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -17,8 +17,8 @@ | |
"memory": 1000000.0 | ||
}, | ||
"reverse_transform": { | ||
"time": 0.002, | ||
"time": 0.01, | ||
"memory": 500000.0 | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -17,8 +17,8 @@ | |
"memory": 1000000.0 | ||
}, | ||
"reverse_transform": { | ||
"time": 0.002, | ||
"time": 0.01, | ||
"memory": 500000.0 | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.