Repository navigation
Conversation
This branch has not been deployed
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.
Summary
Converters that create new columns (
COLUMN_OPERATION = "add", e.g. Bag of Words, TF-IDF, One-Hot, DateFeatures) keep the columns they read next to the ones they create. Most of the time the source column is no longer useful: it clutters the notebook dataset and, in a session, it stays available as a model input that can be picked by mistake.This PR adds a "Drop original columns" option to every column-adding converter. When it is on, the converter's scope columns are removed after it transforms, so only the new columns remain. It is off by default and behaves the same in notebooks and in session preprocessing.
AddColumnsConverterSchema, declaresdrop_source_columns(translated to en, es, pt, de, zh), and the 16 column-adding schemas inherit it.rebuild_dataset_with_transformed_columns, which notebooks and sessions already share.missing_referror.Type of Change
Check all that apply like this [x]:
Changes (by file)
Option and helpers
DashAI/back/converters/drop_source_columns.py(new):AddColumnsConverterSchemawith thedrop_source_columnsfield. It has a realFalsedefault, so params saved before this change keep validating.split_converter_params, which takes the option out of the params before a converter is built.drops_source_columns, the shared rule: the option is on and the converter is"add".reject_output_named_like_scope.DashAI/back/config_object.py:get_schemamovesdrop_source_columnsto the end of the form.AddColumnsConverterSchema:clustering.py,image_embedding.py,summarizer.py,translation/base.pytext_vectorizer.py,binarizer.py,cca.py,label_encoder.py,missing_indicator.py,one_hot_encoder.py,ordinal_encoder.pysam3_segment_converter.py,column_arithmetic.py,column_concat.py,date_features.py,numeric_expansion.pyDashAI/back/converters/dataset_columns.py:rebuild_dataset_with_transformed_columnstakescolumns_to_drop. New column names are planned against the columns that remain.Notebooks and DAG units
DashAI/back/units/converter_scope.py:_merge_transformeddrops the scope columns, except the target._check_drop_scoperefuses an empty scope.DashAI/back/units/apply_converter_unit.py,fit_converter_unit.py: build the converter without the option and publish it asfitted_converter_options.DashAI/back/units/transform_dataset_unit.py: requiresfitted_converter_options, so fitting on one dataset and transforming another drops the same columns. The DAG engine only moves the keys two nodes agree on.DashAI/back/job/converter_job.py: the document path strips the option and otherwise ignores it.Session preprocessing
DashAI/back/preprocessing/structure.py: a dropping step removes its scope from the state, like anexpandstep, and frees those names for later steps.DashAI/back/preprocessing/session_preprocessor.py:transform_only;Bug fix
DashAI/back/converters/simple_converters/column_arithmetic.py,column_concat.py: reject an output column name equal to one of the scope columns.<name>_1, so later references failed at training.Frontend
DashAI/front/src/components/shared/FormSchemaWithSelectedModel.jsx,notebooks/converterCreation/ParameterStepConverter.jsx: accept and forwardexcludeFields.DashAI/front/src/components/notebooks/converterCreation/FormConverterSection.jsx: hidesdrop_source_columnsin document notebooks, and skips the parameter step when it was the only field.Tests
tests/back/converters/test_drop_source_columns.pyandFormConverterSection.test.jsx.test_dataset_columns.pytest_apply_converter_unit.py,test_converter_fit_transform_split.pytest_session_preprocessor.py,test_structure.pytest_engine.pytest_sklearn_option_validity.py,test_structure_matches_runtime.py.test_translation_converters.py.Testing (optional)