Conversation
| result = encoder.transform(test_X) | ||
|
|
||
| # D and E should get default value 0.0 for all bits | ||
| d_row = ( |
| """Test that invalid operator raises ValidationError.""" | ||
| from pydantic import ValidationError | ||
|
|
||
| X = pl.DataFrame({"A": [10, 20, 30], "B": [15, 10, 30]}) |
| """Test that invalid reference_date types raise ValidationError from Pydantic.""" | ||
| from pydantic import ValidationError | ||
|
|
||
| X = pl.DataFrame({"offset": [1, 2, 3]}) |
|
|
||
| def test_validation_mismatched_new_column_names_length(): | ||
| """Test validation error when new_column_names length doesn't match.""" | ||
| X = pl.DataFrame({"value": [10, 20], "group": ["A", "B"]}) |
|
|
||
| def test_validation_mismatched_new_column_names_length(): | ||
| """Test validation error when new_column_names length doesn't match.""" | ||
| X = pl.DataFrame({"value": [10, 20], "group": ["A", "B"]}) |
| # With low smoothing | ||
| encoder_low = LeaveOneOutEncoder(subset=["category"], smoothing=0.1, inplace=False) | ||
| encoder_low.fit(X, y=target) | ||
| result_low = encoder_low.transform(X) |
| # Strings 'a', 'b', 'c' are too short for trigrams | ||
| # Only 'ab' is still too short | ||
| # Should not have any n-grams or very few | ||
| new_features = [col for col in result.columns if col.startswith("text__ng_")] |
|
|
||
| def test_transform_drop_columns_multiple_groups(): | ||
| """Test drop_columns with multiple groups - validation should catch invalid group.""" | ||
| X = pl.DataFrame({"A": [10, 20], "B": [5, 10], "C": [100, 200], "D": [50, 100]}) |
|
|
||
| def test_empty_new_column_names_raises_error(): | ||
| """Test that empty new_column_names list raises ValueError.""" | ||
| X = pl.DataFrame({"A": [10, 20, 30]}) |
| } | ||
| ) | ||
|
|
||
| y = pl.Series("target", [0, 0, 0, 1, 1]) |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New version of Gators using Polars.