Skip to content

Commit

Permalink
[ENH] Rename Feature Constructor to Formula (#6549)
Browse files Browse the repository at this point in the history
* Rename Feature Constructor to Formula

* Update widget.json

* feature-constructor2-stamped.png - resize and index

* Formula documentation: Minor changes

* index.rst - fix reference to formula

* move accidentally displaced formula.md

---------

Co-authored-by: PrimozGodec <p.godec9@gmail.com>
  • Loading branch information
janezd and PrimozGodec committed Sep 8, 2023
1 parent 0aec15e commit a1a1c92
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 73 deletions.
4 changes: 2 additions & 2 deletions Orange/widgets/data/owfeatureconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,12 @@ def is_valid_item(self, setting, item, attrs, metas):


class OWFeatureConstructor(OWWidget, ConcurrentWidgetMixin):
name = "Feature Constructor"
name = "Formula"
description = "Construct new features (data columns) from a set of " \
"existing features in the input dataset."
category = "Transform"
icon = "icons/FeatureConstructor.svg"
keywords = "feature constructor, function, lambda"
keywords = "feature constructor, function, lambda, calculation"
priority = 2240

class Inputs:
Expand Down
2 changes: 1 addition & 1 deletion doc/visual-programming/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Data
widgets/data/paintdata
widgets/data/pivot
widgets/data/pythonscript
widgets/data/featureconstructor
widgets/data/formula
widgets/data/editdomain
widgets/data/impute
widgets/data/mergedata
Expand Down
67 changes: 0 additions & 67 deletions doc/visual-programming/source/widgets/data/featureconstructor.md

This file was deleted.

58 changes: 58 additions & 0 deletions doc/visual-programming/source/widgets/data/formula.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
Formula
=======

Add new features to your dataset.

**Inputs**

- Data: input dataset

**Outputs**

- Data: dataset with additional features

**Formula** allows computing new columns by combining the existing ones with a user-defined expression. The resulting column can be categorical, numerical or textual.

For numeric variables, it sufices to provide a name and an expression.

![](images/feature-constructor1-stamped.png)

1. List of constructed variables
2. Add or remove variables
3. New feature name
4. Expression in Python
5. Select a feature
6. Select a function
7. Produce a report
8. Press *Send* to communicate changes

The following example shows construction of a categorical variable: its value is "lower" is "sepal length" is below 6, "mid" if it is at least 6 but below 7, and "higher" otherwise. Note that spaces need to be replaced by underscores (`sepal_length`).

![](images/feature-constructor2-stamped.png)

1. List of variable definitions
2. Add or remove variables
3. New feature name
4. Expression in Python
5. If checked, the feature is put among meta attributes
6. Select a feature to use in expression
7. Select a function to use in expression
8. Optional list of values, used to define their order
9. Press *Send* to compute and output data

Hints
-----

If you are unfamiliar with Python math language, here's a quick introduction.

Expressions can use the following operators:
- `+`, `-`, `*`, `/`: addition, subtraction, multiplication, division
- `//`: integer division
- `%`: remainder after integer division
- `**`: exponentiation (for square root square by 0.5)
- `<`, `>`, `<=`, `>=` less than, greater than, less or equal, greater or equal
- `==` equal
- `!=` not equal
- if-else: *value* `if` *condition* else *other-value* (see the above example

See more [here](http://www.tutorialspoint.com/python/python_basic_operators.htm).
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
7 changes: 4 additions & 3 deletions doc/widgets.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,15 @@
]
},
{
"text": "Feature Constructor",
"doc": "visual-programming/source/widgets/data/featureconstructor.md",
"text": "Formula",
"doc": "visual-programming/source/widgets/data/formula.md",
"icon": "../Orange/widgets/data/icons/FeatureConstructor.svg",
"background": "#FF9D5E",
"keywords": [
"feature constructor",
"function",
"lambda"
"lambda",
"calculation"
]
},
{
Expand Down

0 comments on commit a1a1c92

Please sign in to comment.