Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Generate PrefixColumnConcatenator with entry point compiler instead of manually. #364

Merged
merged 6 commits into from
Nov 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/python/docs/docstrings/PrefixColumnConcatenator.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""

Combines several columns into a single vector-valued column by prefix.

.. remarks::
``PrefixColumnConcatenator`` creates a single vector-valued column from
multiple
columns. It can be performed on data before training a model. The
concatenation
can significantly speed up the processing of data when the number of
columns
is as large as hundreds to thousands.

:param columns: a dictionary of key-value pairs, where key is the output
column name and value is a list of input column names.

* Only one key-value pair is allowed.
* Input column type: numeric or string.
* Output column type:
`Vector Type </nimbusml/concepts/types#vectortype-column>`_.

The << operator can be used to set this value (see
`Column Operator </nimbusml/concepts/columns>`_)

For example
* ColumnConcatenator(columns={'features': ['age', 'parity',
'induced']})
* ColumnConcatenator() << {'features': ['age', 'parity',
'induced']})

For more details see `Columns </nimbusml/concepts/columns>`_.

.. seealso::
:py:class:`ColumnDropper
<nimbusml.preprocessing.schema.ColumnDropper>`,
:py:class:`ColumnSelector
<nimbusml.preprocessing.schema.ColumnSelector>`.

.. index:: transform, schema

Example:
.. literalinclude:: /../nimbusml/examples/PrefixColumnConcatenator.py
:language: python
"""
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
PrefixColumnConcatenator
"""
Expand All @@ -15,10 +16,12 @@
from ...base_pipeline_item import BasePipelineItem, DefaultSignature


class PrefixColumnConcatenator(BasePipelineItem, DefaultSignature):
class PrefixColumnConcatenator(
BasePipelineItem,
DefaultSignature):
"""

Combines several columns into a single vector-valued column by prefix
Copy link
Member

@ganik ganik Nov 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combines several columns into a single vector-valued column by prefix [](start = 4, length = 69)

need this doc #Resolved

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit.


In reply to: 346961442 [](ancestors = 346961442)

Combines several columns into a single vector-valued column by prefix.

.. remarks::
``PrefixColumnConcatenator`` creates a single vector-valued column from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
PrefixColumnConcatenator
"""
Expand All @@ -17,7 +18,10 @@
from ...internal.utils.utils import trace


class PrefixColumnConcatenator(core, BaseTransform, TransformerMixin):
class PrefixColumnConcatenator(
core,
BaseTransform,
TransformerMixin):
"""

Combines several columns into a single vector-valued column by prefix.
Expand Down
6 changes: 6 additions & 0 deletions src/python/tools/code_fixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,18 @@ def fix_code(class_name, filename):
all_args['output_for_sub_graph'] = {'Model' : \
all_args['predictor_model']}"""

prefixcolumnconcatenator_1 = "output_columns = input_columns"
prefixcolumnconcatenator_1_correct = """raise ValueError(
"'None' output passed when it cannot be none.")"""

signature_fixes_core = {
'NGramFeaturizer': (textTransform_1, textTransform_1_correct),
'ColumnConcatenator': [(concatColumns_1, concatColumns_1_correct)],
'ColumnSelector': [(columnselector_1, columnselector_1_correct)],
'OneVsRestClassifier': [
(onevsrestclassifier_1, onevsrestclassifier_1_correct)],
'PrefixColumnConcatenator': (prefixcolumnconcatenator_1,
prefixcolumnconcatenator_1_correct)
}


Expand Down
6 changes: 6 additions & 0 deletions src/python/tools/manifest_diff.json
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,12 @@
"NewName": "TypeConverter",
"Module": "preprocessing.schema",
"Type": "Transform"
},
{
"Name": "Transforms.PrefixColumnConcatenator",
"NewName": "PrefixColumnConcatenator",
"Module": "preprocessing.schema",
"Type": "Transform"
}
],
"Components": [
Expand Down