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

Commit

Permalink
Generate PrefixColumnConcatenator with entry point compiler instead o…
Browse files Browse the repository at this point in the history
…f manually. (#364)
  • Loading branch information
pieths authored Nov 19, 2019
1 parent 28dcc8b commit 5b97afe
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 3 deletions.
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
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

0 comments on commit 5b97afe

Please sign in to comment.