Orange Visual Programming¶
Getting Started¶
Here we need to copy the getting started guide.
Loading your Data¶
Orange comes with its own data format, but can also handle native Excel (.xlsx or .xls), comma- or tab-delimited data files. The input data set is usually a table, with data instances (samples) in rows and data attributes in columns. Attributes can be of different types (continuous, discrete, time, and strings) and have assigned roles (input features, meta attributes, and class). Data attribute type and role can be provided in the data table header. They can also be subsequently changed in the File widget, while data role can also be modified with Select Columns widget.
In a Nutshell¶
- Orange can import any comma- or tab-delimited data file, or Excel’s native files or Google Sheets document. Use File widget to load the data and, if needed, define the class and meta attributes.
- Attribute names in the column header can be preceded with a label followed by a hash. Use c for class and m for meta attribute, i to ignore a column, w for weights column, and C, D, T, S for continuous, discrete, time, and string attribute types. Examples: C#mph, mS#name, i#dummy.
- An alternative to the hash notation is Orange’s native format with three header rows: the first with attribute names, the second specifying the type (continuous, discrete, time, or string), and the third proving information on the attribute role (class, meta, weight or ignore).
Example: Data from Excel¶
Here is an example data set (download it from sample.xlsx
) as entered in Excel:

The file contains a header row, eight data instances (rows) and seven data attributes (columns). Empty cells in the table denote missing data entries. Rows represent genes; their function (class) is provided in the first column and their name in the second. The remaining columns store measurements that characterize each gene. With this data, we could, say, develop a classifier that would predict gene function from its characteristic measurements.
Let us start with a simple workflow that reads the data and displays it in a table:

To load the data, open the File widget (double click on the icon of the widget), click on the file browser icon (”...”) and locate the downloaded file (from sample.xlsx
) on your disk:

File Widget: Setting the Attribute Type and Role¶
The File widget sends the data to the Data Table. Double click the Data Table to see its contents:

Orange correctly assumed that a column with gene names is meta information, which is displayed in the Data Table in columns shaded with light-brown. It has not guessed that function, the first non-meta column in our data file, is a class column. To correct this in Orange, we can adjust attribute role in the column display of File widget (below). Double-click the feature label in the function row and select target instead. This will set function attribute as our target (class) variable.

You can also change attribute type from nominal to numeric, from string to datetime, and so on. Naturally, data values have to suit the specified attribute type. Datetime accepts only values in ISO 8601 format, e.g. 2016-01-01 16:16:01. Orange would also assume the attribute is numeric if it has several different values, else it would be considered nominal. All other types are considered strings and are as such automatically categorized as meta attributes.
Change of attribute roles and types should be confirmed by clicking the Apply button.
Select Columns: Setting the Attribute Role¶
Another way to set the data role is to feed the data to the Select Columns widget:

Opening Select Columns reveals Orange’s classification of attributes. We would like all of our continuous attributes to be data features, gene function to be our target variable and gene names considered as meta attributes. We can obtain this by dragging the attribute names around the boxes in Select Columns:

To correctly reassign attribute types, drag attribute named function to a Class box, and attribute named gene to a Meta Attribute box. The Select Columns widget should now look like this:

Change of attribute types in Select Columns widget should be confirmed by clicking the Apply button. The data from this widget is fed into Data Table that now renders the data just the way we intended:

We could also define the domain for this data set in a different way. Say, we could make the data set ready for regression, and use heat 0 as a continuous class variable, keep gene function and name as meta variables, and remove heat 10 and heat 20 from the data set:

By setting the attributes as above, the rendering of the data in the Data Table widget gives the following output:

Header with Attribute Type Information¶
Consider again the sample.xlsx
data set. This time
we will augment the names of the attributes with prefixes
that define attribute type (continuous, discrete, time, string) and role (class or meta attribute)
Prefixes are separated from the attribute name with a hash sign (“#”). Prefixes for attribute roles are:
- c: class attribute
- m: meta attribute
- i: ignore the attribute
- w: instance weights
and for the type:
- C: Continuous
- D: Discrete
- T: Time
- S: String
This is how the header with augmented attribute names looks like in
Excel (sample-head.xlsx
):

We can again use a File widget to load this data set and then render it in the Data Table:

Notice that the attributes we have ignored (label “i” in the attribute name) are not present in the data set.
Three-Row Header Format¶
Orange’s legacy native data format is a tab-delimited text file with three header rows. The first row lists the attribute names, the second row defines their type (continuous, discrete, time and string, or abbreviated c, d, t, and s), and the third row an optional role (class, meta, weight, or ignore). Here is an example:

Data from Google Sheets¶
Orange can read data from Google Sheets, as long as it conforms to the data presentation rules we have presented above. In Google Sheets, copy the shareable link (Share button, then Get shareable link) and paste it in the Data File / URL box of the File widget. For a taste, here’s one such link you can use: http://bit.ly/1J12Tdp, and the way we have entered it in the File widget:

Data from LibreOffice¶
If you are using LibreOffice, simply save your files in Excel (.xlsx or .xls) format (available from the drop-down menu under Save As Type).

Widgets¶
Data¶
File¶

Reads attribute-value data from an input file.
Description¶
The File widget reads the input data file (data table with data instances) and sends the data set to its output channel. The history of most recently opened files is maintained in the widget. The widget also includes a directory with sample data sets that come pre-installed with Orange.
The widget reads data from Excel (.xlsx), simple tab-delimited (.txt), comma-separated files (.csv) or URLs.

- Browse through previously opened data files, or load any of the sample ones.
- Browse for a data file.
- Reloads currently selected data file.
- Insert data from URL adresses, including data from Google Sheets.
- Information on the loaded data set: data set size, number and types of data features.
- Additional information on the features in the data set. Features can be edited by double-clicking on them. The user can change the attribute names, select the type of variable per each attribute (Continuous, Nominal, String, Datetime), and choose how to further define the attributes (as Features, Targets or Meta). The user can also decide to ignore an attribute.
- Browse documentation data sets.
- Produce a report.
Example¶
Most Orange workflows would probably start with the File widget. In the schema below, the widget is used to read the data that is sent to both the Data Table and the Box Plot widget.

Loading your data¶
- Orange can import any comma, .xlsx or tab-delimited data file or URL. Use the File widget and then, if needed, select class and meta attributes.
- To specify the domain and the type of the attribute, attribute names can be preceded with a label followed by a hash. Use c for class and m for meta attribute, i to ignore a column, and C, D, S for continuous, discrete and string attribute types. Examples: C#mpg, mS#name, i#dummy. Make sure to set Import Options in File widget and set the header to Orange simplified header.
- Orange’s native format is a tab-delimited text file with three header rows. The first row contains attribute names, the second the type (continuous, discrete or string), and the third the optional element (class, meta or string).

Read more on loading your data here.
SQL Table¶

Reads data from an SQL database.
Description¶
The SQL widget accesses data stored in an SQL database. It can connect to PostgreSQL (requires psycopg2 module) or SQL Server (requires pymssql module).

Save Data¶

Saves data to a file.
Description¶
The Save Data widget considers a data set provided in the input channel and saves it to a data file with a specified name. It can save the data as a tab-delimited or a comma-separated file.
The widget does not save the data every time it receives a new signal in the input as this would constantly (and, mostly, inadvertently) overwrite the file. Instead, the data is saved only after a new file name is set or the user pushes the Save button.

- Save by overwriting the existing file.
- Save as to create a new file.
Example¶
In the workflow below, we used the Zoo data set. We loaded the data into the Scatter Plot widget, with which we selected a subset of data instances and pushed them to the Save Data widget to store them in a file.

Data Info¶

Displays information on a selected data set.
Description¶
A simple widget that presents information on data set size, features, targets, meta attributes, and location.

- Information on data set size
- Information on discrete and continuous features
- Information on targets
- Information on meta attributes
- Information on where the data is stored
- Produce a report.
Example¶
Below, we compare the basic statistics of two Data Info widgets - one with information on the entire data set and the other with information on the (manually) selected subset from the Scatterplot widget. We used the Iris data set.

Data Table¶

Displays attribute-value data in a spreadsheet.
Description¶
The Data Table widget receives one or more data sets in its input and presents them as a spreadsheet. Data instances may be sorted by attribute values. The widget also supports manual selection of data instances.

- The name of the data set (usually the input data file). Data instances are in rows and their attribute values in columns. In this example, the data set is sorted by the attribute “sepal length”.
- Info on current data set size and number and types of attributes
- Values of continuous attributes can be visualized with bars; colors can be attributed to different classes.
- Data instances (rows) can be selected and sent to the widget’s output channel.
- Use the Restore Original Order button to reorder data instances after attribute-based sorting.
- Produce a report.
- While auto-send is on, all changes will be automatically communicated to other widgets. Otherwise, press Send Selected Rows.
Example¶
We used two File widgets to read the Iris and Glass data set (provided in Orange distribution), and send them to the Data Table widget.

Selected data instances in the first Data Table are passed to the second Data Table. Notice that we can select which data set to view (iris or glass). Changing from one data set to another alters the communicated selection of data instances if Commit on any change is selected.

Select Columns¶

Manual selection of data attributes and composition of data domain.
Signals¶
Inputs:
Data
Attribute-valued data set.
Outputs:
Data
Attribute-valued data set composed using the domain specification from the widget.
Description¶
The Select Columns widget is used to manually compose your data domain. The user can decide which attributes will be used and how. Orange distinguishes between ordinary attributes, (optional) class attributes and meta attributes. For instance, for building a classification model, the domain would be composed of a set of attributes and a discrete class attribute. Meta attributes are not used in modelling, but several widgets can use them as instance labels.
Orange attributes have a type and are either discrete, continuous or a character string. The attribute type is marked with a symbol appearing before the name of the attribute (D, C, S, respectively).

- Left-out data attributes that will not be in the output data file
- Data attributes in the new data file
- Target variable. If none, the new data set will be without a target variable.
- Meta attributes of the new data file. These attributes are included in the data set but are, for most methods, not considered in the analysis.
- Produce a report.
- Reset the domain composition to that of the input data file.
- Tick if you wish to auto-apply changes of the data domain.
- Apply changes of the data domain and send the new data file to the output channel of the widget.
Examples¶
In the workflow below, the Iris data from the File widget is fed into the Select Columns widget, where we select to output only two attributes (namely petal width and petal length). We view both the original data set and the data set with selected columns in the Data Table widget.

For a more complex use of the widget, we composed a workflow to redefine the classification problem in the heart-disease data set. Originally, the task was to predict if the patient has a coronary artery diameter narrowing. We changed the problem to that of gender classification, based on age, chest pain and cholesterol level, and informatively kept the diameter narrowing as a meta attribute.

Select Rows¶

Selects data instances based on conditions over data features.
Signals¶
Inputs:
Data
Data set.
Outputs:
Matching Data
Instances that match the conditions.
Non-Matching Data
Instances that do not match the conditions.
Description¶
This widget selects a subset from an input data set, based on user-defined conditions. Instances that match the selection rule are placed in the output Matching Data channel.
Criteria for data selection are presented as a collection of conjuncted terms (i.e. selected items are those matching all the terms in ‘Conditions‘).
Condition terms are defined through selecting an attribute, selecting an operator from a list of operators, and, if needed, defining the value to be used in the condition term. Operators are different for discrete, continuous and string attributes.

- Conditions you want to apply, their operators and related values
- Add a new condition to the list of conditions.
- Add all the possible variables at once.
- Remove all the listed variables at once.
- Information on the input data set and information on instances that match the condition(s)
- Purge the output data.
- When the Send automatically box is ticked, all changes will be automatically communicated to other widgets.
- Produce a report.
Any change in the composition of the condition will update the information pane (Data Out).
If Send automatically is selected, then the output is updated on any change in the composition of the condition or any of its terms.
Example¶
In the workflow below, we used the Zoo data from the File widget and fed it into the Select Rows widget. In the widget, we chose to output only two animal types, namely fish and reptiles. We can inspect both the original data set and the data set with selected rows in the Data Table widget.

In the next example, we used the data from the Titanic data set and similarly fed it into the Box Plot widget. We first observed the entire data set based on survival. Then we selected only first class passengers in the Select Rows widget and fed it again into the Box Plot. There we could see all the first class passengers listed by their survival rate and grouped by gender.

Data Sampler¶

Selects a subset of data instances from an input data set.
Signals¶
Inputs:
Data
Input data set to be sampled.
Outputs:
Data Sample
A set of sampled data instances.
Remaining Data
All other data instances from the input data set, which are not included in the sample.
Description¶
The Data Sampler widget implements several means of sampling data from an input channel. It outputs a sampled and a complementary data set (with instances from the input set that are not included in the sampled data set). The output is processed after the input data set is provided and Sample Data is pressed.

- Information on the input and output data set
- The desired sampling method:
- Fixed proportion of data returns a selected percentage of the entire data (e.g. 70% of all the data)
- Fixed sample size returns a selected number of data instances with a chance to set Sample with replacement, which always samples from the entire data set (does not subtract instances already in the subset)
- Cross Validation partitions data instances into complementary subsets, where you can select the number of folds (subsets) and which fold you want to use as a sample.
- Replicable sampling maintains sampling patterns that can be carried across users, while stratification mimics the composition of the input data set.
- Produce a report.
- Press Sample data to output the data sample.
Examples¶
First, let’s see how the Data Sampler works. Let’s look at the information on the original data set in the Data Info widget. We see there are 24 instances in the data (we used lenses.tab). We sampled the data with the Data Sampler widget and we chose to go with a fixed sample size of 5 instances for simplicity. We can observe the sampled data in the Data Table widget. The second Data Table shows the remaining 19 instances that weren’t in the sample.

In the workflow below, we have sampled 10 data instances from the Iris data set and sent the original data and the sample to Scatter Plot widget for exploratory data analysis. The sampled data instances are plotted with filled circles, while the original data set is represented with empty circles.

Transpose¶

Transposes a data table.
Example¶
This is a simple workflow showing how to use Transpose. Connect the widget to File widget. The output of Transpose is a transposed data table with rows as columns and columns as rows. You can observe the result in a Data Table.

Discretize¶

Discretizes continuous attributes from an input data set.
Description¶
The Discretize widget discretizes continuous attributes with a selected method.

The basic version of the widget is rather simple. It allows choosing between three different discretizations.
- Entropy-MDL, invented by Fayyad and Irani is a top-down discretization, which recursively splits the attribute at a cut maximizing information gain, until the gain is lower than the minimal description length of the cut. This discretization can result in an arbitrary number of intervals, including a single interval, in which case the attribute is discarded as useless (removed).
- Equal-frequency splits the attribute into a given number of intervals, so that they each contain approximately the same number of instances.
- Equal-width evenly splits the range between the smallest and the largest observed value. The Number of intervals can be set manually.
- The widget can also be set to leave the attributes continuous or to remove them.
To treat attributes individually, go to Individual Attribute Settings. They show a specific discretization of each attribute and allow changes. First, the top left list shows the cut-off points for each attribute. In the snapshot, we used the entropy-MDL discretization, which determines the optimal number of intervals automatically; we can see it discretized the age into seven intervals with cut-offs at 21.50, 23.50, 27.50, 35.50, 43.50, 54.50 and 61.50, respectively, while the capital-gain got split into many intervals with several cut-offs. The final weight (fnlwgt), for instance, was left with a single interval and thus removed.
On the right, we can select a specific discretization method for each attribute. Attribute “fnlwgt” would be removed by the MDL-based discretization, so to prevent its removal, we select the attribute and choose, for instance, Equal-frequency discretization. We could also choose to leave the attribute continuous.
Produce a report.
Tick Apply automatically for the widget to automatically commit changes. Alternatively, press Apply.
Example¶
In the schema below, we show the Iris data set with continuous attributes (as in the original data file) and with discretized attributes.

Continuize¶

Turns discrete attributes into continuous dummy variables.
Description¶
The Continuize widget receives a data set in the input and outputs the same data set in which the discrete attributes (including binary attributes) are replaced with continuous ones.

- Continuization methods, which define the treatment of multivalued discrete attributes. Say that we have a discrete attribute status with the values low, middle and high, listed in that order. Options for their transformation are:
- Target or First value as base: the attribute will be transformed into two continuous attributes, status=middle with values 0 or 1 signifying whether the original attribute had value middle on a particular example, and similarly, status=high. Hence, a three-valued attribute is transformed into two continuous attributes, corresponding to all except the first value of the attribute.
- Most frequent value as base: similar to the above, except that the data is analyzed and the most frequent value is used as a base. So, if most examples have the value middle, the two newly constructed continuous attributes will be status=low and status=high.
- One attribute per value: this would construct three continuous attributes out of a three-valued discrete one.
- Ignore multinominal attributes: removes the multinominal attributes from the data.
- Treat as ordinal: converts the attribute into a continuous attribute with values 0, 1, and 2.
- Divide by number of values: same as above, except that the values are normalized into range 0-1. So, our case would give values 0, 0.5 and 1.
- Define the treatment of continuous attributes. You will usually prefer the Leave them as they are option. The alternative is Normalize by span, which will subtract the lowest value found in the data and divide by the span, so all values will fit into [0, 1]. Finally, Normalize by standard deviation subtracts the average and divides by the deviation.
- Define the treatment of class attributes. Besides leaving it as it is, there are also a couple of options available for multinominal attributes, except for those options which split the attribute into more than one attribute - this obviously cannot be supported since you cannot have more than one class attribute.
- With value range, you can define the values of new attributes. In the above text, we supposed the range from 0 to 1. You can change it to from -1 to 1.
- Produce a report.
- If Apply automatically is ticked, changes are committed automatically. Otherwise, you have to press Apply after each change.
Examples¶
First, let’s see what is the output of the Continuize widget. We feed the original data (the Heart disease data set) into the Data Table and see how they look like. Then we continuize the discrete values and observe them in another Data Table.

In the second example, we show a typical use of this widget - in order to properly plot the linear projection of the data, discrete attributes need to be converted to continuous ones and that is why we put the data through the Continuize widget before drawing it. The attribute “chest pain” originally had four values and was transformed into three continuous attributes; similar happened to gender, which was transformed into a single attribute “gender=female”.

Create Class¶

Create class attribute from a string attribute.
Description¶
Create Class creates a new class attribute from an existing discrete or string attribute. The widget matches the string value of the selected attribute and constructs a new user-defined value for matching instances.

- The attribute the new class is constructed from.
- Matching: - Name: the name of the new class value - Substring: regex-defined substring that will match the values from the above-defined attribute - Instances: the number of instances matching the substring - Press ‘+’ to add a new class value
- Name of the new class column.
- Match only at the beginning will begin matching from the beginning of the string. Case sensitive will match by case, too.
- Produce a report.
- Press Apply to commit the results.
Example¶
Here is a simple example with the auto-mpg data set. Pass the data to Create Class. Select car_name as a column to create the new class from. Here, we wish to create new values that match the car brand. First, we type ford as the new value for the matching strings. Then we define the substring that will match the data instances. This means that all instances containing ford in their car_name, will now have a value ford in the new class column. Next, we define the same for honda and fiat. The widget will tell us how many instance are yet unmatched (remaining instances). We will name them other, but you can continue creating new values by adding a condition with ‘+’.
We named our new class column car_brand and we matched at the beginning of the string.

Finally, we can observe the new column in a Data Table or use the value as color in the Scatterplot.
Randomize¶

Shuffles classes, attributes and/or metas of an input data set.
Description¶
The Randomize widget receives a data set in the input and outputs the same data set in which the classes, attributes or/and metas are shuffled.

- Select group of columns of the data set you want to shuffle.
- Select proportion of the data set you want to shuffle.
- Produce replicable output.
- If Apply automatically is ticked, changes are committed automatically. Otherwise, you have to press Apply after each change.
- Produce a report.
Example¶
The Randomize widget is usually placed right after (e.g. File widget. The basic usage is shown in the following workflow, where values of class variable of Iris data set are randomly shuffled.

In the next example we show how shuffling class values influences model performance on the same data set as above.

Concatenate¶

Concatenates data from multiple sources.
Signals¶
Inputs:
Primary Data
A data set that defines the attribute set.
Additional Data
An additional data set.
Outputs:
- Data
Description¶
The widget concatenates multiple sets of instances (data sets). The merge is “vertical”, in a sense that two sets of 10 and 5 instances yield a new set of 15 instances.

- Set the attribute merging method.
- Add the identification of source data sets to the output data set.
- Produce a report.
- If Apply automatically is ticked, changes are communicated automatically. Otherwise, click Apply.
If one of the tables is connected to the widget as the primary table, the resulting table will contain its own attributes. If there is no primary table, the attributes can be either a union of all attributes that appear in the tables specified as Additional Tables, or their intersection, that is, a list of attributes common to all the connected tables.
Example¶
As shown below, the widget can be used for merging data from two separate files. Let’s say we have two data sets with the same attributes, one containing instances from the first experiment and the other instances from the second experiment and we wish to join the two data tables together. We use the Concatenate widget to merge the data sets by attributes (appending new rows under existing attributes).
Below, we used a modified Zoo data set. In the
first
File widget, we loaded only the animals
beginning with the letters A and B and in the second
one only the animals beginning with the letter C. Upon concatenation, we
observe the new data in the Data Table widget, where we see the
complete table with animals from A to C.

Paint Data¶

Paints data on a 2D plane. You can place individual data points or use a brush to paint larger data sets.
Description¶
The widget supports the creation of a new data set by visually placing data points on a two-dimension plane. Data points can be placed on the plane individually (Put) or in a larger number by brushing (Brush). Data points can belong to classes if the data is intended to be used in supervised learning.

- Name the axes and select a class to paint data instances. You can add or remove classes. Use only one class to create classless, unsupervised data sets.
- Drawing tools. Paint data points with Brush (multiple data instances) or Put (individual data instance). Select data points with Select and remove them with the Delete/Backspace key. Reposition data points with Jitter (spread) and Magnet (focus). Use Zoom and scroll to zoom in or out. Below, set the radius and intensity for Brush, Put, Jitter and Magnet tools.
- Reset to Input Data.
- Save Image saves the image to your computer in a .svg or .png format.
- Produce a report.
- Tick the box on the left to automatically commit changes to other widgets. Alternatively, press Send to apply them.
Example¶
In the example below, we have painted a data set with 4 classes. Such data set is great for demonstrating k-means and hierarchical clustering methods. In the screenshot, we see that k-means, overall, recognizes clusters better than hierarchical clustering. It returns a score rank, where the best score (the one with the highest value) means the most likely number of clusters. Hierarchical clustering, however, doesn’t group the right classes together. This is a great tool for learning and exploring statistical concepts.

Python Script¶

Extends functionalities through Python scripting.
Signals¶
Inputs:
in_data (Orange.data.Table)
Input data set bound to
in_data
variable in the script’s local namespace.in_distance (Orange.core.SymMatrix)
Input symmetric matrix bound to
in_distance
variable in the script’s local namespace.in_learner (Orange.classification.Learner)
Input learner bound to
in_learner
variable in the script’s local namespace.in_classifier (Orange.classification.Learner)
Input classifier bound to
in_classifier
variable in the script’s local namespace.in_object (object)
Input python object bound to
in_object
variable in the script’s local namespace.
Outputs:
out_data (Orange.data.Table)
Data set retrieved from
out_data
variable in the script’s local namespace after execution.out_distance (Orange.core.SymMatrix)
Symmetric matrix retrieved from
out_distance
variable in the script’s local namespace after execution.out_learner (Orange.classification.Learner)
Learner retrieved from
out_learner
variable in the script’s local namespace.out_classifier (Orange.classification.Learner)
Classifier retrieved from
out_classifier
variable in the script’s local namespace after execution.out_object (object)
Python object retrieved from
out_object
variable in the script’s local namespace after execution.
Description¶
Python Script widget can be used to run a python script in the
input, when a suitable functionality is not implemented in an existing
widget. The script has in_data
, in_distance
, in_learner
,
in_classifier
and in_object
variables (from input signals) in
its local namespace. If a signal is not connected or it did not yet
receive any data, those variables contain None
.
After the script is executed, out_data
, out_distance
, …
variables from the script’s local namespace are extracted and used as
outputs of the widget. The widget can be further connected to other
widgets for visualizing the output.
For instance the following script would simply pass on all signals it receives:
out_data = in_data
out_distance = in_distance
out_learner = in_learner
out_classifier = in_classifier
out_object = in_object
Note
You should not modify the input objects in place.

- Info box contains names of basic operators for Orange Python script.
- The Library control can be used to manage multiple scripts. Pressing “+” will add a new entry and open it in the Python script editor. When the script is modified, its entry in the Library will change to indicate it has unsaved changes. Pressing Update will save the script (keyboard shortcut ctrl + s). A script can be removed by selecting it and pressing the “-” button.
- Pressing Execute in the Run box executes the script (using
exec
). Any script output (fromprint
) is captured and displayed in the Console below the script. If Auto execute is checked, the script is run any time inputs to the widget change. - The Python script editor on the left can be used to edit a script (it supports some rudimentary syntax highlighting).
- Console displays the output of the script.
Examples¶
Python Script widget is intended to extend functionalities for advanced users.
One can, for example, do batch filtering by attributes. We used zoo.tab for the example and we filtered out all the attributes that have more than 5 discrete values. This in our case removed only ‘leg’ attribute, but imagine an example where one would have many such attributes.
from Orange.data import Domain, Table
domain = Domain([attr for attr in in_data.domain.attributes
if attr.is_continuous or len(attr.values) <= 5],
in_data.domain.class_vars)
out_data = Table(domain, in_data)

The second example shows how to round all the values in a few lines of code. This time we used wine.tab and rounded all the values to whole numbers.
import numpy as np
out_data = in_data.copy()
#copy, otherwise input data will be overwritten
np.round(out_data.X, 0, out_data.X)

The third example introduces some gaussian noise to the data. Again we make a copy of the input data, then walk through all the values with a double for loop and add random noise.
import random
from Orange.data import Domain, Table
new_data = in_data.copy()
for inst in new_data:
for f in inst.domain.attributes:
inst[f] += random.gauss(0, 0.02)
out_data = new_data

The final example uses Orange3-Text add-on. Python Script is very useful for custom preprocessing in text mining, extracting new features from strings, or utilizing advanced nltk or gensim functions. Below, we simply tokenized our input data from deerwester.tab by splitting them by whitespace.
print('Running Preprocessing ...')
tokens = [doc.split(' ') for doc in in_data.documents]
print('Tokens:', tokens)
out_object = in_data
out_object.store_tokens(tokens)
You can add a lot of other preprocessing steps to further adjust the output. The output of Python Script can be used with any widget that accepts the type of output your script produces. In this case, connection is green, which signalizes the right type of input for Word Cloud widget.

Feature Constructor¶

Add new features to your data set.
Description¶
The Feature Constructor allows you to manually add features (columns) into your data set. The new feature can be a computation of an existing one or a combination of several (addition, subtraction, etc.). You can choose what type of feature it will be (discrete, continuous or string) and what its parameters are (name, value, expression). For continuous variables you only have to construct an expression in Python.

- List of constructed variables
- Add or remove variables.
- New feature name
- Expression in Python
- Select a feature.
- Select a function.
- Produce a report.
- Press Send to communicate changes.
For discrete variables, however, there’s a bit more work. First add or remove the values you want for the new feature. Then select the base value and the expression. In the example below, we have constructed an expression with ‘if lower than’ and defined three conditions; the program ascribes 0 (which we renamed to lower) if the original value is lower than 6, 1 (mid) if it is lower than 7 and 2 (higher) for all the other values. Notice that we use an underscore for the feature name (e.g. petal_length).

- List of variable definitions
- Add or remove variables
- New feature name
- Expression in Python
- Select a feature.
- Select a function.
- Assign values.
- Produce a report.
- Press Send to communicate changes.
Example¶
With the Feature Constructor you can easily adjust or combine existing features into new ones. Below, we added one new discrete feature to the Titanic data set. We created a new attribute called Financial status and set the values to be rich if the person belongs to the first class (status = first) and not rich for everybody else. We can see the new data set with Data Table widget.

Hints¶
If you are unfamiliar with Python math language, here’s a quick introduction.
- +, - to add, subtract
- * to multiply
- / to divide
- % to divide and return the remainder
- ** for exponent (for square root square by 0.5)
- // for floor division
- <, >, <=, >= less than, greater than, less or equal, greater or equal
- == for equal
- != for not equal
As in the example: (value) if (feature name) < (value), else (value) if (feature name) < (value), else (value)
[Use value 1 if feature is less than specified value, else use value 2 if feature is less than specified value 2, else use value 3.]
See more here.
Edit Domain¶

Description¶
This widget can be used to edit/change a data set’s domain.

- All features (including meta attributes) from the input data set are listed in the Domain Features list in the box on the left. Selecting one feature displays an editor on the right.
- The name of the feature can be changed in the Name line edit. For Discrete features, value names can also be changed in the Values list box. Additonal feature annotations can be added/removed/edited in the Labels box. To add a new label, click the “+” button and add the Key and Value columns for the new entry. Selecting an existing label and pressing “-” will remove the annotation.
- To revert the changes made to the feature, press the Reset Selected button in the Reset box while the feature is selected in the Domain Features list. Pressing Reset All will reset all features in the domain at the same time.
- Pressing the Apply button will send the changed domain data set to the output channel.
Example¶
Below, we demonstrate how to simply edit an existing domain. We selected the lenses.tab data set and edited the perscription attribute. Where in the original we had the values myope and hypermetrope, we changed it into nearsightedness and farsightedness instead. For an easier comparison, we fed both the original and edited data into the Data Table widget.

Image Viewer¶

Displays images that come with a data set.
Description¶
The Image Viewer widget can display images from a data set, which are stored locally or on the internet. It can be used for image comparison, while looking for similarities or discrepancies between selected data instances (e.g. bacterial growth or bitmap representations of handwriting).

- Information on the data set
- Select the column with image data (links).
- Select the column with image titles.
- Zoom in or out.
- Saves the visualization in a file.
- Tick the box on the left to commit changes automatically. Alternatively, click Send.
Impute¶

Replaces unknown values in the data.
Signals¶
Inputs
Data
A data set.
Learner for Imputation
A learning algorithm to be used when values are imputed with a predictive model. This algorithm, if given, substitutes the default (1-NN).
Outputs
Data
The same data set as in the input, but with the missing values imputed.
Description¶
Some Orange’s algorithms and visualizations cannot handle unknown values in the data. This widget does what statisticians call imputation: it substitutes missing values by values either computed from the data or set by the user.

- In the top-most box, Default method, the user can specify a general
imputation technique for all attributes.
- Don’t Impute does nothing with the missing values.
- Average/Most-frequent uses the average value (for continuous attributes) or the most common value (for discrete attributes).
- As a distinct value creates new values to substitute the missing ones.
- Model-based imputer constructs a model for predicting the missing value, based on values of other attributes; a separate model is constructed for each attribute. The default model is 1-NN learner, which takes the value from the most similar example (this is sometimes referred to as hot deck imputation). This algorithm can be substituted by one that the user connects to the input signal Learner for Imputation. Note, however, that if there are discrete and continuous attributes in the data, the algorithm needs to be capable of handling them both; at the moment only 1-NN learner can do that. (In the future, when Orange has more regressors, the Impute widget may have separate input signals for discrete and continuous models.)
- Random values computes the distributions of values for each attribute and then imputes by picking random values from them.
- Remove examples with missing values removes the example containing missing values. This check also applies to the class attribute if Impute class values is checked.
- It is possible to specify individual treatment for each attribute, which overrides the default treatment set. One can also specify a manually defined value used for imputation. In the screenshot, we decided not to impute the values of “normalized-losses” and “make”, the missing values of “aspiration” will be replaced by random values, while the missing values of “body-style” and “drive-wheels” are replaced by “hatchback” and “fwd”, respectively. If the values of “length”, “width” or “height” are missing, the example is discarded. Values of all other attributes use the default method set above (model-based imputer, in our case).
- The imputation methods for individual attributes are the same as default. methods.
- Restore All to Default resets the individual attribute treatments to default.
- Produce a report.
- All changes are committed immediately if Apply automatically is checked. Otherwise, Apply needs to be ticked to apply any new settings.
Example¶
To demonstrate how the Impute widget works, we played around with the Iris data set and deleted some of the data. We used the Impute widget and selected the Model-based imputer to impute the missing values. In another Data Table, we see how the question marks turned into distinct values (“Iris-setosa, “Iris-versicolor”).

Merge Data¶

Merges two data sets, based on values of selected attributes.
Signals¶
Inputs:
Data
Attribute-valued data set.
Extra Data
Attribute-valued data set.
Outputs:
Data
Instances from input data to which attributes from input extra data are added.
Description¶
The Merge Data widget is used to horizontally merge two data sets, based on values of selected attributes. In the input, two data sets are required, data and extra data. The widget allows selection of an attribute from each domain, which will be used to perform the merging. The widget produces one output. It corresponds to instances from the input data to which attributes from input extra data are appended.
Merging is done by values of selected (merging) attributes. First, the value of the merging attribute from Data is taken and instances from Extra Data are searched for matching values. If more than a single instance from Extra Data was to be found, the attribute is removed from available merging attributes.

- Information on Data
- Information on Extra Data
- Merging type. Append columns from Extra Data outputs all instances from Data appended by matching instances from Extra Data. When no match is found, unknown values are appended. Find matching rows outputs similar as above, except hen no match is found, instances are excluded. Concatenate tables, merge rows outputs all instances from both inputs, even though the match may not be found. In that case unknown values are assigned.
- List of comparable attributes from Data
- List of comparable attributes from Extra Data
- Produce a report.
Example¶
Merging two data sets results in appending new attributes to the
original file, based on a selected common attribute. In the example
below, we wanted to merge the zoo.tab file containing only factual
data with zoo-with-images.tab
containing images. Both files share a common string attribute names. Now, we
create a workflow connecting the two files. The zoo.tab data is
connected to Data input of the Merge Data widget, and the
zoo-with-images.tab data to the Extra Data input. Outputs of the
Merge Data widget is then connected to the Data Table widget.
In the latter, the Merged Data channels are shown, where image attributes
are added to the original data.

The case where we want to include all instances in the output, even those where no match by attribute names was found, is shown in the following workflow.

The third type of merging is shown in the next workflow. The output consist of both inputs, with unknown values assigned where no match was found.

Hint¶
If the two data sets consist of equally-named attributes (other than the ones used to perform the merging), Orange will check by default for consistency of the values of these attributes and report an error in case of non-matching values. In order to avoid the consistency checking, make sure that new attributes are created for each data set: you may use the ‘Columns with the same name in different files represent different variables‘ option in the File widget for loading the data.
Outliers¶

Simple outlier detection by comparing distances between instances.
Signals¶
Inputs:
Data
A data set
Distances
A distance matrix
Outputs:
Outliers
A data set containing instances scored as outliers
Inliers
A data set containing instances not scored as outliers
Description¶
The Outliers widget applies one of the two methods for outlier detection. Both methods apply classification to the data set, one with SVM (multiple kernels) and the other with elliptical envelope. One-class SVM with non-linear kernels (RBF) performs well with non-Gaussian distributions, while Covariance estimator works only for data with Gaussian distribution.

- Information on the input data, number of inliers and outliers based on the selected model.
- Select the Outlier detection method:
- One class SVM with non-linear kernel (RBF): classifies data as
similar or different from the core class
- Nu is a parameter for the upper bound on the fraction of training errors and a lower bound of the fraction of support vectors
- Kernel coefficient is a gamma parameter, which specifies how much influence a single data instance has
- Covariance estimator: fits ellipsis to central points with
Mahalanobis distance metric
- Contamination is the proportion of outliers in the data set
- Support fraction specifies the proportion of points included in the estimate
- One class SVM with non-linear kernel (RBF): classifies data as
similar or different from the core class
- Produce a report.
- Click Detect outliers to output the data.
Example¶
Below, is a simple example of how to use this widget. We used the Iris data set to detect the outliers. We chose the one class SVM with non-linear kernel (RBF) method, with Nu set at 20% (less training errors, more support vectors). Then we observed the outliers in the Data Table widget, while we sent the inliers to the Scatter Plot.

Preprocess¶

Preprocesses data with selected methods.
Signals¶
Inputs:
Data
A data set.
Outputs:
Preprocessor
A preprocessing method.
Preprocessed Data
Data preprocessed with selected methods.
Description¶
Preprocessing is crucial for achieving better-quality analysis results. The Preprocess widget offers five preprocessing methods to improve data quality. In this widget, you can immediately discretize continuous values or continuize discrete ones, impute missing values, select relevant features or center and scale them. Basically, this widget combines four separate widgets for simpler processing.

- List of preprocessors. You drag the preprocessors you wish to use to the right side of the widget.
- Discretization of continuous values
- Continuization of discrete values
- Impute missing values or remove them.
- Select the most relevant features by information gain, gain ratio, Gini index.
- Select random features
- Normalize features
- Randomize
- When the box is ticked (Send Automatically), the widget will communicate changes automatically. Alternatively, click Send.
- Produce a report.
Example¶
In the example below, we have used the adult data set and preprocessed the data. We continuized discrete values (age, education and marital status...) as one attribute per value, we imputed missing values (replacing ? with average values), selected 10 most relevant attributes by Information gain, centered them by mean and scaled by span. We can observe the changes in the Data Table and compare it to the non-processed data.

Purge Domain¶

Removes unused attribute values and useless attributes, sorts the remaining values.
Description¶
Definitions of nominal attributes sometimes contain values which don’t appear in the data. Even if this does not happen in the original data, filtering the data, selecting examplary subsets and alike can remove all examples for which the attribute has some particular value. Such values clutter data presentation, especially various visualizations, and should be removed.
After purging an attribute, it may become single-valued or, in extreme case, have no values at all (if the value of this attribute was undefined for all examples). In such cases, the attribute can be removed.
A different issue is the order of attribute values: if the data is read from a file in a format in which values are not declared in advance, they are sorted “in order of appearance”. Sometimes we would prefer to have them sorted alphabetically.

- Purge attributes.
- Purge classes.
- Purge meta attributes.
- Information on the filtering process
- Produce a report.
- If Apply automatically is ticked, the widget will output data at each change of widget settings.
Such purification is done by the widget Purge Domain. Ordinary attributes and class attributes are treated separately. For each, we can decide if we want the values sorted or not. Next, we may allow the widget to remove attributes with less than two values or remove the class attribute if there are less than two classes. Finally, we can instruct the widget to check which values of attributes actually appear in the data and remove the unused values. The widget cannot remove values if it is not allowed to remove the attributes, since having attributes without values makes no sense.
The new, reduced attributes get the prefix “R”, which distinguishes them from the original ones. The values of new attributes can be computed from the old ones, but not the other way around. This means that if you construct a classifier from the new attributes, you can use it to classify the examples described by the original attributes. But not the opposite: constructing a classifier from the old attributes and using it on examples described by the reduced ones won’t work. Fortunately, the latter is seldom the case. In a typical setup, one would explore the data, visualize it, filter it, purify it… and then test the final model on the original data.
Example¶
The Purge Domain widget would typically appear after data filtering, for instance when selecting a subset of visualized examples.
In the above schema, we play with the adult.tab data set: we visualize it and select a portion of the data, which contains only four out of the five original classes. To get rid of the empty class, we put the data through Purge Domain before going on to the Box Plot widget. The latter shows only the four classes which are in the Purge Data output. To see the effect of data purification, uncheck Remove unused class variable values and observe the effect this has on Box Plot.

Rank¶

Ranking of attributes in classification or regression data sets.
Signals¶
Inputs:
Data
An input data set.
Scorer (multiple)
Models that implement the feature scoring interface, such as linear / logistic regression, random forest, stochastic gradient descent, etc.
Outputs:
Reduced Data
A data set whith selected attributes.
Description¶
The Rank widget considers class-labeled data sets (classification or regression) and scores the attributes according to their correlation with the class.

- Select attributes from the data table.
- Data table with attributes (rows) and their scores by different scoring methods (columns)
- Produce a report.
- If ‘Send Automatically‘ is ticked, the widget automatically communicates changes to other widgets.
Scoring methods¶
- Information Gain: the expected amount of information (reduction of entropy)
- Gain Ratio: a ratio of the information gain and the attribute’s intrinsic information, which reduces the bias towards multivalued features that occurs in information gain
- Gini: the inequality among values of a frequency distribution
- ANOVA: the difference between average vaules of the feature in different classes
- Chi2: dependence between the feature and the class as measure by the chi-square statistice
- ReliefF: the ability of an attribute to distinguish between classes on similar data instances
- FCBF (Fast Correlation Based Filter): entropy-based measure, which also identifies redundancy due to pairwise correlations between features
Additionally, you can connect certain learners that enable scoring the features according to how important they are in models that the learners build (e.g. Linear / Logistic Regression, Random Forest, SGD, …).
Example: Attribute Ranking and Selection¶
Below, we have used the Rank widget immediately after the File widget to reduce the set of data attributes and include only the most informative ones:

Notice how the widget outputs a data set that includes only the best-scored attributes:

Example: Feature Subset Selection for Machine Learning¶
What follows is a bit more complicated example. In the workflow below, we first split the data into a training set and a test set. In the upper branch, the training data passes through the Rank widget to select the most informative attributes, while in the lower branch there is no feature selection. Both feature selected and original data sets are passed to their own Test & Score widgets, which develop a Naive Bayes classifier and score it on a test set.

For data sets with many features, a naive Bayesian classifier feature selection, as shown above, would often yield a better predictive accuracy.
Color¶

Set color legend for variables.
Description¶
The Color widget enables you to set the color legend in your visualizations according to your own preferences. This option provides you with the tools for emphasizing your results and offers a great variety of color options for presenting your data. It can be combined with most visualizations widgets.

- A list of discrete variables. You can set the color of each variable by double-clicking on it and opening the Color palette or the Select color window. The widget also enables text-editing. By clicking on a variable, you can change its name.
- A list of continuous variables. You can customize the color gradients by double-clicking on them. The widget also enables text-editing. By clicking on a variable, you can change its name. If you hover over the right side side of the gradient, Copy to all appears. You can then apply your customized color gradient to all variables.
- Produce a report.
- Apply changes. If Apply automatically is ticked, changes will be communicated automatically. Alternatively, just click Apply.
Discrete variables¶

- Choose a desired color from the palette of basic colors.
- Move the cursor to choose a custom color from the color palette.
- Choose a custom color from your previously saved color choices.
- Specify the custom color by:
- entering the red, green, and blue components of the color as values between 0 (darkest) and 255 (brightest)
- entering the hue, saturation and luminescence components of the color as values in the range 0 to 255
- Add the created color to your custom colors.
- Click OK to save your choices or Cancel to exit the the color palette.
Numeric variables¶

- Choose a gradient from your saved profiles. The default profile is already set.
- The gradient palette
- Select the left side of the gradient. Double clicking the color opens the Select Color window.
- Select the right side of the gradient. Double clicking the color opens the Select Color window.
- Pass through black.
- Click OK to save your choices or Cancel to exit the color palette.
Example¶
We chose to work with the Iris data set. We opened the color palette and selected three new colors for the three types of Irises. Then we opened the Scatter Plot widget and viewed the changes made to the scatter plot.

For our second example, we wished to demonstrate the use of the Color widget with continuous variables. We put different types of Irises on the x axis and petal length on the y axis. We created a new color gradient and named it greed (green + red). In order to show that sepal length is not a deciding factor in differentiating between different types of Irises, we chose to color the points according to sepal width.

Visualize¶
Box Plot¶

Shows distribution of attribute values.
Description¶
The Box Plot widget shows the distributions of attribute values. It is a good practice to check any new data with this widget to quickly discover any anomalies, such as duplicated values (e.g. gray and grey), outliers, and alike.

- Select the variable you want to see plotted.
- Choose Grouping to see box plots displayed by class.
- When instances are grouped by class, you can change the display mode. Annotated boxes will display the end values, the mean and the median, while compare medians and compare means will, naturally, compare the selected value between class groups.

For continuous attributes the widget displays:
- The mean (the dark blue vertical line)
- Border values for the standard deviation of the mean. The blue highlighted area is the entire standard deviation of the mean.
- The median (yellow vertical line). The thin blue line represents the area between the first (25%) and the third (75%) quantile, while the thin dotted line represents the entire range of values (from the lowest to the highest value in the data set for the selected parameter).
- Save image.
- Produce a report.
For discrete attributes, the bars represent the number of instances with each particular attribute value. The plot shows the number of different animal types in the Zoo data set: there are 41 mammals, 13 fish, 20 birds and so on.

Example¶
The Box Plot widget is most commonly used immediately after the File widget to observe the statistical properties of a data set. It is also useful for finding the properties of a specific data set, for instance a set of instances manually defined in another widget (e.g. Scatterplot) or instances belonging to some cluster or a classification tree node, as shown in the schema below.


Distributions¶

Displays value distributions for a single attribute.
Description¶
The Distributions widget displays the value distribution of discrete or continuous attributes. If the data contains a class variable, distributions may be conditioned on the class.
For discrete attributes, the graph displayed by the widget shows how many times (e.g., in how many instances) each attribute value appears in the data. If the data contains a class variable, class distributions for each of the attribute values will be displayed as well (like in the snapshot below). In order to create this graph, we used the Zoo data set.

- A list of variables for distributions display
- If Bin continuous variables is ticked, the widget will discretize continuous variables by assigning them to intervals. The number of intervals is set by precision scale. Alternatively, you can set smoothness for the distribution curves of continuous variables.
- The widget may be requested to display value distributions only for instances of certain class (Group by). Show relative frequencies will scale the data by percentage of the data set.
- Show probabilities.
- Save image saves the graph to your computer in a .svg or .png format.
- Produce a report.
For continuous attributes, the attribute values are displayed as a function graph. Class probabilities for continuous attributes are obtained with gaussian kernel density estimation, while the appearance of the curve is set with the Precision bar (smooth or precise). For the purpose of this example, we used the Iris data set.

In class-less domains, the bars are displayed in gray. Here we set Bin continuous variables into 10 bins, which distributes variables into 10 intervals and displays averages of these intervals as histograms (see 2. above). We used the Housing data set.

Heat Map¶

Plots a heat map for a pair of attributes.
Signals¶
Inputs:
Data
An input data set.
Outputs:
Selected Data
A subset of instances that the user has manually selected from the map.
Description¶
Heat map is a graphical method for visualizing attribute values by class in a two-way matrix. It only works on data sets containing continuous variables. The values are represented by color: the higher a certain value is, the darker the represented color. By combining class and attributes on x and y axes, we see where the attribute values are the strongest and where the weakest, thus enabling us to find typical features (discrete) or value range (continuous) for each class.

- The color scheme legend. Low and High are thresholds for the color palette (low for attributes with low values and high for attributes with high values).
- Merge data.
- Sort columns and rows: - No Sorting (lists attributes as found in the data set) - Clustering (clusters data by similarity) - Clustering with ordered leaves (maximizes the sum of similarities of adjacent elements)
- Set what is displayed in the plot in Annotation & Legend. - If Show legend is ticked, a color chart will be displayed above the map. - If Stripes with averages is ticked, a new line with attribute averages will be displayed on the left. - Row Annotations adds annotations to each instance on the right. - Column Label Positions places column labels in a selected place (None, Top, Bottom, Top and Bottom).
- If Keep aspect ratio is ticked, each value will be displayed with a square (proportionate to the map).
- If Send Automatically is ticked, changes are communicated automatically. Alternatively, click Send.
- Save image saves the image to your computer in a .svg or .png format.
- Produce a report.
Example¶
The Heat Map below displays attribute values for the Housing data set. The aforementioned data set concerns the housing values in the suburbs of Boston. The first thing we see in the map are the ‘B’ and ‘Tax’ attributes, which are the only two colored in dark orange. The ‘B’ attribute provides information on the proportion of blacks by town and the ‘Tax’ attribute informs us about the full-value property-tax rate per $10,000. In order to get a clearer heat map, we then use the Select Columns widget and remove the two attributes from the data set. Then we again feed the data to the Heat map. The new projection offers additional information. By removing ‘B’ and ‘Tax’, we can see other deciding factors, namely ‘Age’ and ‘ZN’. The ‘Age’ attribute provides information on the proportion of owner-occupied units built prior to 1940 and the ‘ZN’ attribute informs us about the proportion of non-retail business acres per town.

The Heat Map widget is a nice tool for discovering relevant features in the data. By removing some of the more pronounced features, we came across new information, which was hiding in the background.
References¶
Scatter Plot¶

Scatterplot visualization with explorative analysis and intelligent data visualization enhancements.
Signals¶
Inputs:
Data
An input data set.
Data Subset
A subset of instances from the input data set.
Features
A list of attributes.
Outputs:
Selected Data
A subset of instances that the user manually selected from the scatterplot.
Data
Data with an additional column showing whether a point is selected.
Description¶
The Scatterplot widget provides a 2-dimensional scatterplot visualization for both continuous and discrete-valued attributes. The data is displayed as a collection of points, each having the value of the x-axis attribute determining the position on the horizontal axis and the value of the y-axis attribute determining the position on the vertical axis. Various properties of the graph, like color, size and shape of the points, axis titles, maximum point size and jittering can be adjusted on the left side of the widget. A snapshot below shows the scatterplot of the Iris data set with the coloring matching of the class attribute.

- Select the x and y attribute. Optimize your projection by using Rank Projections. This feature scores attribute pairs by average classification accuracy and returns the top scoring pair with a simultaneous visualization update. Set jittering to prevent the dots overlapping. If Jitter continuous values is ticked, continuous instances will be dispersed.
- Set the color of the displayed points (you will get colors for discrete values and grey-scale points for continuous). Set label, shape and size to differentiate between points. Set symbol size and opacity for all data points. Set the desired colors scale.
- Adjust plot properties:
- Show legend displays a legend on the right. Click and drag the legend to move it.
- Show gridlines displays the grid behind the plot.
- Show all data on mouse hover enables information bubbles if the cursor is placed on a dot.
- Show class density colors the graph by class (see the screenshot below).
- Show regression line draws the regression line for pair of continuous attributes.
- Label only selected points allows you to select individual data instances and label them.
- Select, zoom, pan and zoom to fit are the options for exploring the graph. The manual selection of data instances works as an angular/square selection tool. Double click to move the projection. Scroll in or out for zoom.
- If Send automatically is ticked, changes are communicated automatically. Alternatively, press Send.
- Save Image saves the created image to your computer in a .svg or .png format.
- Produce a report.
For discrete attributes, jittering circumvents the overlap of points which have the same value for both axes, and therefore the density of points in the region corresponds better to the data. As an example, the scatterplot for the Titanic data set, reporting on the gender of the passengers and the traveling class is shown below; without jittering, the scatterplot would display only eight distinct points.

Here is an example of the Scatter Plot widget if the Show class density and Show regression line boxes are ticked.

Intelligent Data Visualization¶
If a data set has many attributes, it is impossible to manually scan through all the pairs to find interesting or useful scatterplots. Orange implements intelligent data visualization with the Find Informative Projections option in the widget. The goal of optimization is to find scatterplot projections where instances are well separated.
To use this method, go to the Find Informative Projections option in the widget, open the subwindow and press Start Evaluation. The feature will return a list of attribute pairs by average classification accuracy score.
Below, there is an example demonstrating the utility of ranking. The first scatterplot projection was set as the default sepal width to sepal length plot (we used the Iris data set for simplicity). Upon running Find Informative Projections optimization, the scatterplot converted to a much better projection of petal width to petal length plot.

Selection¶
Selection can be used to manually defined subgroups in the data. Use Shift modifier when selecting data instances to put them into a new group. Shift + Ctrl (or Shift + Cmd on macOs) appends instances to the last group.
Signal data outputs a data table with an additional column that contains group indices.

Explorative Data Analysis¶
The Scatterplot, as the rest of Orange widgets, supports zooming-in and out of part of the plot and a manual selection of data instances. These functions are available in the lower left corner of the widget. The default tool is Select, which selects data instances within the chosen rectangular area. Pan enables you to move the scatterplot around the pane. With Zoom you can zoom in and out of the pane with a mouse scroll, while Reset zoom resets the visualization to its optimal size. An example of a simple schema, where we selected data instances from a rectangular region and sent them to the Data Table widget, is shown below. Notice that the scatterplot doesn’t show all 52 data instances, because some data instances overlap (they have the same values for both attributes used).

Example¶
The Scatterplot can be combined with any widget that outputs a list of selected data instances. In the example below, we combine Tree and Scatterplot to display instances taken from a chosen decision tree node (clicking on any node of the tree will send a set of selected data instances to the scatterplot and mark selected instances with filled symbols).

Venn Diagram¶

Plots a Venn diagram for two or more data subsets.
Signals¶
Inputs:
Data
An input data set
Outputs:
Selected Data
A subset of instances that the user has manually selected from the diagram.
Description¶
The Venn Diagram widget displays logical relations between data sets. This projection shows two or more data sets represented by circles of different colors. The intersections are subsets that belong to more than one data set. To further analyze or visualize the subset, click on the intersection.


- Information on the input data.
- Select the identifiers by which to compare the data.
- Tick Output duplicates if you wish to remove duplicates.
- If Auto commit is on, changes are automatically communicated to other widgets. Alternatively, click Commit.
- Save Image saves the created image to your computer in a .svg or .png format.
- Produce a report.
Examples¶
The easiest way to use the Venn Diagram is to select data subsets and find matching instances in the visualization. We use the breast-cancer data set to select two subsets with Select Rows widget - the first subset is that of breast cancer patients aged between 40 and 49 and the second is that of patients with a tumor size between 20 and 29. The Venn Diagram helps us find instances that correspond to both criteria, which can be found in the intersection of the two circles.

The Venn Diagram widget can be also used for exploring different prediction models. In the following example, we analysed 3 prediction methods, namely Naive Bayes, SVM and Random Forest, according to their misclassified instances. By selecting misclassifications in the three Confusion Matrix widgets and sending them to Venn diagram, we can see all the misclassification instances visualized per method used. Then we open Venn Diagram and select, for example, the misclassified instances that were identified by all three methods (in our case 2). This is represented as an intersection of all three circles. Click on the intersection to see this two instances marked in the Scatterplot widget. Try selecting different diagram sections to see how the scatterplot visualization changes.

Linear Projection¶

A linear projection method with explorative data analysis.
Signals¶
Inputs:
Data
An input data set
Data Subset
A subset of data instances
Outputs:
Selected Data
A data subset that the user has manually selected in the projection.
Description¶
This widget displays linear projections of class-labeled data. Consider, for a start, a projection of the Iris data set shown below. Notice that it is the sepal width and sepal length that already separate Iris setosa from the other two, while the petal length is the attribute best separating Iris versicolor from Iris virginica.

- Axes in the projection that are displayed and other available axes.
- Set the color of the displayed dots (you will get colored dots for discrete values and grey-scale dots for continuous). Set opacity, shape and size to differentiate between instances.
- Set jittering to prevent the dots from overlapping (especially for discrete attributes).
- Select, zoom, pan and zoom to fit options for exploring the graph. Manual selection of data instances works as a non-angular/free-hand selection tool. Double click to move the projection. Scroll in or out for zoom.
- When the box is ticked (Auto commit is on), the widget will communicate the changes automatically. Alternatively, click Commit.
- Save Image saves the created image to your computer in a .svg or .png format.
- Produce a report.
Example¶
The Linear Projection widget works just like other visualization widgets. Below, we connected it to the File widget to see the set projected on a 2-D plane. Then we selected the data for further analysis and connected it to the Data Table widget to see the details of the selected subset.

References¶
Koren Y., Carmel L. (2003). Visualization of labeled data using linear transformations. In Proceedings of IEEE Information Visualization 2003, (InfoVis‘03). Available here.
Boulesteix A.-L., Strimmer K. (2006). Partial least squares: a versatile tool for the analysis of high-dimensional genomic data. Briefings in Bioinformatics, 8(1), 32-44. Abstract here.
Scatter Map¶

Plots a scatter map for a pair of continuous attributes.
Description¶
A Scatter map is a graphical method for visualizing frequencies in a two-way matrix by color. The higher the occurrence of a certain value, the darker the represented color. By combining two values on x and y axes, we see where the attribute combination is the strongest and where the weakest, thus enabling the user to find strong correlations or representative instances.

- Select the x and y attribute to be plotted.
- Color the plot by attribute. You can also select which attribute instances you wish to see in the visualization by clicking on them. At the bottom, you can select the color scale strength (linear, square root or logarithmic).
- Sampling is enabled only when the widget is connected to the SQL Table widget. You can set the sampling time for large data to speed up the analysis. Sharpen works for all data types and it will resize (sharpen) the squares in the plot.
- Save Image saves the created image to your computer in a .svg or .png format.
- Produce a report.
Example¶
Below, you can see an example workflow for the Scatter Map widget. Notice that the widget only works with continuous data, so you need to first continuize the data attributes you want to visualize. The Scatter map below displays two attributes from the Iris data set, namely the petal width and petal length. Here, we can see the distribution of width and length values per Iris type. You can see that the variety Iris setosa is distinctly separated from the other two varieties by petal width and length and that the most typical values for these attributes are around 0.2 for petal width and between 1.4 and 1.7 for petal length. This shows that petal width and length are good attributes for telling Iris setosa apart from the other two varieties.

Sieve Diagram¶

Plots a sieve diagram for a pair of attributes.
Description¶
A Sieve diagram is a graphical method for visualizing frequencies in a two-way contingency table and comparing them to expected frequencies under assumption of independence. It was proposed by Riedwyl and Schüpbach in a technical report in 1983 and later called a parquet diagram (Riedwyl and Schüpbach, 1994). In this display, the area of each rectangle is proportional to the expected frequency, while the observed frequency is shown by the number of squares in each rectangle. The difference between observed and expected frequency (proportional to the standard Pearson residual) appears as the density of shading, using color to indicate whether the deviation from independence is positive (blue) or negative (red).

- Select the attributes you want to display in the sieve plot.
- Score combinations enables you to fin the best possible combination of attributes.
- Save Image saves the created image to your computer in a .svg or .png format.
- Produce a report.
The snapshot below shows a sieve diagram for the Titanic data set and has the attributes sex and survived (the latter is a class attribute in this data set). The plot shows that the two variables are highly associated, as there are substantial differences between observed and expected frequencies in all of the four quadrants. For example, and as highlighted in the balloon, the chance for surviving the accident was much higher for female passengers than expected (0.06 vs. 0.15).

Pairs of attributes with interesting associations have a strong shading, such as the diagram shown in the above snapshot. For contrast, a sieve diagram of the least interesting pair (age vs. survival) is shown below.

Example¶
Below, we see a simple schema using the Titanic data set, where we use the Rank widget to select the best attributes (the ones with the highest information gain, gain ratio or gini index) and feed them into the Sieve Diagram. This displays the sieve plot for the two best attributes, which in our case are sex and status. We see that the survival rate on the Titanic was very high for women of the first class and very low for female crew members.
The Sieve Diagram also features the Score Combinations option, which makes the ranking of attributes even easier.
References¶
Riedwyl, H., and Schüpbach, M. (1994). Parquet diagram to plot contingency tables. In Softstat ‘93: Advances in Statistical Software, F. Faulbaum (Ed.). New York: Gustav Fischer, 293-299.
Pythagorean Tree¶

Pythagorean tree visualisation for classification or regression trees.
Signals¶
Inputs:
Tree
A decision tree model.
Selected Data
A subset of instances that the user has manually selected from the Pythagorean tree.
Description¶
Pythagorean Trees are plane fractals that can be used to depict general tree hierarchies as presented in an article by Fabian Beck and co-authors. In our case, they are used for visualizing and exploring tree models, such as Tree.

Information on the input tree model.
Visualization parameters:
- Depth: set the depth of displayed trees.
- Target class (for classification trees): the intensity of the color for nodes of the tree will correspond to the probability of the target class. If None is selected, the color of the node will denote the most probable class.
- Node color (for regression trees): node colors can correspond to mean or standard deviation of class value of the training data instances in the node.
- Size: define a method to compute the size of the square representing the node. Normal will keep node sizes correspond to the size of training data subset in the node. Square root and Logarithmic are the respective transformations of the node size.
- Log scale factor is only enabled when logarithmic transformation is selected. You can set the log factor between 1 and 10.
Plot properties:
- Enable tooltips: display node information upon hovering.
- Show legend: shows color legend for the plot.
- Reporting:
- Save Image: save the visualization to a SVG or PNG file.
- Report: add visualization to the report.
Pythagorean Tree can visualize both classification and regression trees. Below is an example for regression tree. The only difference between the two is that regression tree doesn’t enable coloring by class, but can color by class mean or standard deviation.

Example¶
The workflow from the screenshot below demonstrates the difference between Tree Viewer and Pythagorean Tree. They can both visualize Tree, but Pythagorean visualization takes less space and is more compact, even for a small Iris flower data set. For both visualization widgets, we have hidden the control area on the left by clicking on the splitter between control and visualization area.

Pythagorean Tree is interactive: click on any of the nodes (squares) to select training data instances that were associated with that node. The following workflow explores these feature.
The selected data instances are shown as a subset in the Scatter Plot, sent to the Data Table and examined in the Box Plot. We have used brown-selected data set in this example. The tree and scatter plot are shown below; the selected node in the tree has a black outline.

References¶
Beck, F., Burch, M., Munz, T., Di Silvestro, L. and Weiskopf, D. (2014). Generalized Pythagoras Trees for Visualizing Hierarchies. In IVAPP ‘14 Proceedings of the 5th International Conference on Information Visualization Theory and Applications, 17-28.
Pythagorean Forest¶

Pythagorean forest for visualising random forests.
Signals¶
Inputs:
Random Forest
Classification / regression tree models as random forest.
Outputs:
Tree
A selected classification / regression tree model.
Description¶
Pythagorean Forest shows all learned decision tree models from Random Forest widget. It displays then as Pythagorean trees, each visualization pertaining to one randomly constructed tree. In the visualization, you can select a tree and display it in Pythagorean Tree wigdet. The best tree is the one with the shortest and most strongly colored branches. This means few attributes split the branches well.
Widget displays both classification and regression results. Classification requires discrete target variable in the data set, while regression requires a continuous target variable. Still, they both should be fed a Tree on the input.

Information on the input random forest model.
Display parameters:
- Depth: set the depth to which the trees are grown.
- Target class: set the target class for coloring the trees. If None is selected, tree will be white. If the input is a classification tree, you can color nodes by their respective class. If the input is a regression tree, the options are Class mean, which will color tree nodes by the class mean value and Standard deviation, which will color then by the standard deviation value of the node.
- Size: set the size of the nodes. Normal will keep nodes the size of the subset in the node. Square root and Logarithmic are the respective transformations of the node size.
- Zoom: allows you to se the size of the tree visualizations.
Save Image: save the visualization to your computer as a .svg or .png file. Report: produce a report.
Example¶
Pythagorean Forest is great for visualizing several built trees at once. In the example below, we’ve used housing data set and plotted all 10 trees we’ve grown with Random Forest. When changing the parameters in Random Forest, visualization in Pythagorean Forest will change as well.
Then we’ve selected a tree in the visualization and inspected it further with Pythagorean Tree widget.

References¶
Beck, F., Burch, M., Munz, T., Di Silvestro, L. and Weiskopf, D. (2014). Generalized Pythagoras Trees for Visualizing Hierarchies. In IVAPP ‘14 Proceedings of the 5th International Conference on Information Visualization Theory and Applications, 17-28.
CN2 Rule Viewer¶

CN2 Rule Viewer
Signals¶
Inputs:
Data
Data set to filter.
CN2 Rule Classifier
CN2 Rule Classifier, including a list of induced rules.
Outputs:
Filtered Data
If data is connected, upon active selection (at least one rule is selected), filtered data is emitted. Output are data instances covered by all selected rules.
Description¶
A widget that displays CN2 classification rules. If data is also connected, upon rule selection, one can analyze which instances abide to the conditions.

- Original order of induced rules can be restored.
- When rules are many and complex, the view can appear packed. For this reason, compact view was implemented, which allows a flat presentation and a cleaner inspection of rules.
- Click Report to bring up a detailed description of the rule induction algorithm and its parameters, the data domain, and induced rules.
Additionally, upon selection, rules can be copied to clipboard by pressing the default system shortcut (ctrl+C, cmd+C).
Examples¶
In the schema below, the most common use of the widget is presented. First, the data is read and a CN2 rule classifier is trained. We are using titanic data set for the rule constrution. The rules are then viewed using the Rule Viewer. To explore different CN2 algorithms and understand how adjusting parameters influences the learning process, Rule Viewer should be kept open and in sight, while setting the CN2 learning algorithm (the presentation will be updated promptly).

Selecting a rule outputs filtered data instances. These can be viewed in a Data Table.
Mosaic Display¶

Display data in a mosaic plot.
Signals¶
Inputs:
Data
An input data set.
Data subset
An input data subset.
Outputs:
Selected data
A subset of instances that the user has manually selected from the plot.
Description¶
The Mosaic plot is a graphical representation of a two-way frequency table or a contingency table. It is used for visualizing data from two or more qualitative variables and was introduced in 1981 by Hartigan and Kleiner and expanded and refined by Friendly in 1994. It provides the user with the means to more efficiently recognize relationships between different variables. If you wish to read up on the history of Mosaic Display, additional reading is available here.

- Select the variables you wish to see plotted.
- Select interior coloring. You can color the interior according to class or you can use the Pearson residual, which is the difference between observed and fitted values, divided by an estimate of the standard deviation of the observed value. If Compare to total is clicked, a comparison is made to all instances.
- Save image saves the created image to your computer in a .svg or .png format.
- Produce a report.
Example¶
We loaded the titanic data set and connected it to the Mosaic Display widget. We decided to focus on two variables, namely status, sex and survival. We colored the interiors according to Pearson residuals in order to demonstrate the difference between observed and fitted values.

We can see that the survival rates for men and women clearly deviate from the fitted value.
Silhouette Plot¶

A graphical representation of consistency within clusters of data.
Signals¶
Inputs
Data
A data set.
Outputs
Selected Data
A subset of instances that the user has manually selected from the plot.
Other Data
Remaining data.
Description¶
The Silhouette Plot widget offers a graphical representation of consistency within clusters of data and provides the user with the means to visually assess cluster quality. The silhouette score is a measure of how similar an object is to its own cluster in comparison to other clusters and is crucial in the creation of a silhoutte plot. The silhouette score close to 1 indicates that the data instance is close to the center of the cluster and instances posessing the silhouette scores close to 0 are on the border between two clusters.

- Choose the distance metric. You can choose between:
- Select the cluster label. You can decide whether to group the instances by cluster or not.
- Display options:
- Choose bar width.
- Annotations: annotate the silhouette plot.
- Save Image saves the created silhouette plot to your computer in a .png or .svg format.
- Produce a report.
- Output:
- Add silhouette scores (good clusters have higher silhoutte scores)
- By clicking Commit, changes are comminicated to the output of the widget. Alternatively, tick the box on the left and changes will be communicated automatically.
- The created silhouette plot.
Example¶
In the snapshot below, we have decided to use the Silhoutte Plot on the iris data set. We selected data intances with low silhouette scores and passed them on as a subset to the Scatter Plot widget. This visualization only confirms the accuracy of the Silhouette Plot widget, as you can clearly see that the subset lies in the border between two clusters.

If you are interested in other uses of the Silhouette Plot widget, feel free to explore our blog post.
Tree Viewer¶

A visualization of classification and regression trees.
Signals¶
Inputs:
Tree
A decision tree.
Outputs:
Selected Data
Data from a selected tree node.
Data
Data set with an additional attribute for selection labels.
Description¶
This is a versatile widget with 2-D visualization of classification and regression trees. The user can select a node, instructing the widget to output the data associated with the node, thus enabling explorative data analysis.
- Information on the input.
- Display options:
- Zoom in and zoom out
- Select the tree width. The nodes display information bubbles when hovering over them.
- Select the depth of your tree.
- Select edge width. The edges between the nodes in the tree graph are drawn based on the selected edge width.
- All the edges will be of equal width if Fixed is chosen.
- When Relative to root is selected, the width of the edge will correspond to the proportion of instances in the corresponding node with respect to all the instances in the training data. Under this selection, the edge will get thinner and thinner when traversing toward the bottom of the tree.
- Relative to parent makes the edge width correspond to the proportion of instances in the nodes with respect to the instances in their parent node.
- Define the target class, which you can change based on classes in the data.
- Press Save image to save the created tree graph to your computer as a .svg or .png file.
- Produce a report.
Examples¶
Below, is a simple classification schema, where we have read the data, constructed the decision tree and viewed it in our Tree Viewer. If both the viewer and Tree are open, any re-run of the tree induction algorithm will immediately affect the visualization. You can thus use this combination to explore how the parameters of the induction algorithm influence the structure of the resulting tree.

Clicking on any node will output the related data instances. This is explored in the schema below that shows the subset in the data table and in the Scatterplot. Make sure that the tree data is passed as a data subset; this can be done by connecting the Scatterplot to the File widget first, and connecting it to the Tree Viewer widget next. Selected data will be displayed as bold dots.
Tree Viewer can also export labelled data. Connect Data Table to Tree Viewer and set the link between widgets to Data instead of Selected Data. This will send the entire data to Data Table with an additional meta column labelling selected data instances (Yes for selected and No for the remaining).

Finally, Tree Viewer can be used also for visualizing regression trees. Connect Random Forest to File widget using housing.tab data set. Then connect Pythagorean Forest to Random Forest. In Pythagorean Forest select a regression tree you wish to further analyze and pass it to the Tree Viewer. The widget will display the constructed tree. For visualizing larger trees, especially for regression, Pythagorean Tree could be a better option.

Geo Map¶

Show data points on a world map.
Signals¶
Inputs:
Data
An input data set.
Data Subset
A subset of instances from the input data set.
Learner
A learning algorithm (classification or regression).
Outputs:
Selected Data
A subset of instances that the user has manually selected from the map.
Data
Data set with an appended meta attribute specifying selected and unselected data.
Description¶
Geo Map widget maps geo-spatial data on a world map. It only works on data sets containing latitude and longitude variables. It also enables class predictions when a learner is provided on the input.
- Define map properties: - Set the type of map: Black and White, OpenStreetMap, Topographic, Satellite, Print, Light, Dark, Railyways and Watercolor. - Set latitude and longitude attributes, if the widget didn’t recognize them automatically. Latitude values should be between -90(S) and 90(N) and longitude values between -180(W) and 180(E).
- Overlay: - Set the target (class) for predictive mapping. A learner has to be provided on the input. The classifier is trained on latitude and longitude pairs only (i.e. it maps lat/lon pairs to the selected attribute).
- Set point parameters: - Color: color of data points by attribute values - Label: label data points with an attribute (available when zoomed in) - Shape: shape of data points by attribute (available when zoomed in) - Size: size of data points by attribute - Opacity: set transparency of data points - Symbol size: size of data points (small to large) - Jittering: disperse overlaid data points - Cluster points: cluster neighboring points with naive greedy clustering (available when less than 600 points are in view)
- If Send Selection Automatically is ticked, changes are communicated automatically. Alternatively, click Send Selection. Save image saves the image to your computer in a .svg or .png format.
Note
To select a subset of points from the map, hold Shift and draw a rectangle around the point you want to output.
Examples¶
In the first example we will model class predictions on a map. We will use philadelphia-crime data set, load it with File widget and connect it to Map. We can already observe the mapped points in Map. Now, we connect Tree to Map and set target variable to Type. This will display the predicted type of crime for a specific region of Philadelphia city (each region will be colored with a corresponding color code, explained in a legend on the right).

The second example uses global-airports.csv data. Say we somehow want to predict the altitude of the area based soley on the latitude and longitude. We again load the data with File widget and connect it to Map. Then we use a regressor, say, KNN and connect it to Map as well. Now we set target to altitude and use Black and White map type. The model guessed the Himalaya, but mades some errors elsewhere.

Nomogram¶

Nomograms for visualization of Naive Bayes and Logistic Regression classifiers.
Signals¶
Inputs:
Classifier
A trained classifier (Naive Bayes or Logistic regression).
Data
Data instance.
Description¶
The Nomogram enables some classifier’s (more precisely Naive Bayes classifier and Logistic Regression classifier) visual representation. It offers an insight into the structure of the training data and effects of the attributes on the class probabilities. Besides visualization of the classifier, the widget offers interactive support to prediction of class probabilities. A snapshot below shows the nomogram of the Titanic data set, that models the probability for a passenger not to survive the disaster of the Titanic.

- Select the target class you want to model the probability for.
- By default Scale is set to Log odds ration. For easier understanding and interpretation option Point scale can be used. The unit is obtained by re-scaling the log odds so that the maximal absolute log odds ratio in the nomogram represents 100 points.
- When there are to many attributes in the plotted data set, you can choose to display only best ranked ones. It is possible to choose from ‘No sorting’, ‘Name’, ‘Absolute importance’, ‘Positive influence’ and ‘Negative influence’ for Naive Bayes representation and from ‘No sorting’, ‘Name’ and ‘Absolute importance’ for Logistic Regression representation.
To represent nomogram for Logistic Regressing classifier Iris data set is used:

- The probability for the chosen target class is computed by 1. vs. all principle, which should be taken in consideration when dealing with multiclass data (alternating probabilities do not sum to 1). To avoid this inconvenience, you can choose to normalize probabilities.
- Continuous attributes can be plotted in 2D (only for Logistic Regression).
- Save image.
- Produce a report.
Example¶
The Nomogram widget should be used immediately after trained classifier widget (e.g. Naive Bayes. It can also be passed a data instance using any widget that enables selection (e.g. Data Table) as shown in the workflow below.

Referring to the Titanic data set once again, 1490 (68%) of passengers on Titanic, of 2201 in total, died. To make a prediction, the contribution of each attribute is measured as a point score and the individual point scores are summed to determine the probability. When the value of the attribute is unknown, its contribution is 0 points. Therefore, not knowing anything about the passenger, the total point score is 0, and the corresponding probability equals to the unconditional prior. The nomogram in the example shows the case when we know that the passenger is a male adult from the first class. The points sum to -0.36, with a corresponding probability of not surviving of about 53%.
Model¶
Naive Bayes¶

A fast and simple probabilistic classifier based on Bayes’ theorem with the assumption of feature independence.
Signals¶
Inputs:
Data
A data set
Preprocessor
Preprocessing method(s)
Outputs:
Learner
A naive bayes learning algorithm with settings as specified in the dialog.
Model
A trained classifier. Output signal sent only if input Data is present.
Description¶
Naive Bayes learns a Naive Bayesian model from the data.
It only works for classification tasks.
This widget has two options: the name under which it will appear in other widgets and producing a report. The default name is Naive Bayes. When you change it, you need to press Apply.
Examples¶
Here, we present two uses of this widget. First, we compare the results of the Naive Bayes with another model, the Random Forest. We connect iris data from File to Test&Score. We also connect Naive Bayes and Random Forest to Test & Score and observe their prediction scores.

The second schema shows the quality of predictions made with Naive Bayes. We feed the Test&Score widget a Naive Bayes learner and then send the data to the Confusion Matrix. We also connect Scatterplot with File. Then we select the misclassified instances in the Confusion Matrix and show feed them to Scatterplot. The bold dots in the scatterplot are the misclassified instances from Naive Bayes.

Logistic Regression¶

The logistic regression classification algorithm with LASSO (L1) or ridge (L2) regularization.
Signals¶
Inputs:
Data
A data set
Preprocessor
Preprocessing method(s)
Outputs:
Learner
A logistic regression learning algorithm with settings as specified in the dialog.
Logistic Regression Classifier
A trained classifier. Output signal sent only if input Data is present.
Description¶
Logistic Regression learns a Logistic Regression model from the data.
It only works for classification tasks.
- A name under which the learner appears in other widgets. The default name is “Logistic Regression”.
- Regularization type (either L1 or L2). Set the cost strength (default is C=1).
- Press Apply to commit changes. If Apply Automatically is ticked, changes will be communicated automatically.
Example¶
The widget is used just as any other widget for inducing a classifier. This is an example demonstrating prediction results with logistic regression on the hayes-roth data set. We first load hayes-roth_learn in the File widget and pass the data to Logistic Regression. Then we pass the trained model to Predictions.
Now we want to predict class value on a new data set. We load hayes-roth_test in the second File widget and connect it to Predictions. We can now observe class values predicted with Logistic Regression directly in Predictions.

Tree¶

A tree algorithm with forward pruning.
Signals¶
Inputs:
Data
A data set
Preprocessor
Preprocessing method(s)
Outputs:
Learner
A decision tree learning algorithm with settings as specified in the dialog.
Model
A subset of data instances from the training set that were used as support vectors in the trained model.
Description¶
Tree is a simple algorithm that splits the data into nodes by class purity. It is a precursor to Random Forest. Tree in Orange is designed in-house and can handle both discrete and continuous data sets.
It can also be used for both classification and regression tasks.
- The learner can be given a name under which it will appear in other widgets. The default name is “Tree”.
- Tree parameters: - Induce binary tree: build a binary tree (split into two child nodes) - Min. number of instances in leaves: if checked, the algorithm will never construct a split which would put less than the specified number of training examples into any of the branches. - Do not split subsets smaller than: forbids the algorithm to split the nodes with less than the given number of instances. - Limit the maximal tree depth: limits the depth of the classification tree to the specified number of node levels.
- Stop when majority reaches [%]: stop splitting the nodes after a specified majority threshold is reached
- Produce a report. After changing the settings, you need to click Apply, which will put the new learner on the output and, if the training examples are given, construct a new classifier and output it as well. Alternatively, tick the box on the left and changes will be communicated automatically.
Examples¶
There are two typical uses for this widget. First, you may want to induce a model and check what it looks like in Tree Viewer.

The second schema trains a model and evaluates its performance against Logistic Regression.

We used the iris data set in both examples. However, Tree works for regression tasks as well. Use housing data set and pass it to Tree. The selected tree node from Tree Viewer is presented in the Scatter Plot and we can see that the selected examples exhibit the same features.

kNN¶

Predict according to the nearest training instances.
Signals¶
Inputs:
Data
A data set
Preprocessor
Preprocessing method(s)
Outputs:
Learner
A kNN learning algorithm with settings as specified in the dialog.
Model
A trained model. Output signal sent only if input Data is present.
Description¶
The kNN widget uses the kNN algorithm that searches for k closest training examples in feature space and uses their average as prediction.
A name under which it will appear in other widgets. The default name is “kNN”.
Set the number of nearest neighbors, the distance parameter (metric) and weights as model criteria. Metric can be:
- Euclidean (“straight line”, distance between two points)
- Manhattan (sum of absolute differences of all attributes)
- Maximal (greatest of absolute differences between attributes)
- Mahalanobis (distance between point and distribution).
The Weights you can use are:
- Uniform: all points in each neighborhood are weighted equally.
- Distance: closer neighbors of a query point have a greater influence than the neighbors further away.
Produce a report.
When you change one or more settings, you need to click Apply, which will put a new learner on the output and, if the training examples are given, construct a new model and output it as well. Changes can also be applied automatically by clicking the box on the left side of the Apply button.
Examples¶
The first example is a classification task on iris data set. We compare the results of k-Nearest neighbors with the default model Constant, which always predicts the majority class.

The second example is a regression task. This workflow shows how to use the Learner output. For the purpose of this example, we used the housing data set. We input the kNN prediction model into Predictions and observe the predicted values.

Load Model¶

Load a model from an input file.
Description¶
- Choose from a list of previously used models.
- Browse for saved models.
- Reload the selected model.
Example¶
When you want to use a custom-set model that you’ve saved before, open the Load Model widget and select the desired file with the Browse icon. This widget loads the exisiting model into Predictions widget. Data sets used with Load Model have to contain compatible attributes!

Constant¶

Predict the most frequent class or mean value from the training set.
Signals¶
Inputs:
Data
A data set
Preprocessor
Preprocessing method(s)
Outputs:
Learner
A majority/mean learning algorithm
Model
A trained model. Output signal sent only if input Data is present.
Description¶
This learner produces a model that always predicts the majority for classification tasks and mean value for regression tasks.
For classification, when predicting the class value with Predictions, the widget will return relative frequencies of the classes in the training set. When there are two or more majority classes, the classifier chooses the predicted class randomly, but always returns the same class for a particular example.
For regression, it learns the mean of the class variable and returns a predictor with the same mean value.
The widget is typically used as a baseline for other models.
This widget provides the user with two options:
- The name under which it will appear in other widgets. Default name is “Constant”.
- Produce a report.
If you change the widget’s name, you need to click Apply. Alternatively, tick the box on the left side and changes will be communicated automatically.
Examples¶
In a typical classification example, we would use this widget to compare the scores of other learning algorithms (such as kNN) with the default scores. Use iris data set and connect it to Test & Score. Then connect Constant and kNN to Test & Score and observe how well kNN performs against a constant baseline.

For regression, we use Constant to construct a predictor in Predictions. We used the housing data set. In Predictions, you can see that Mean Learner returns one (mean) value for all instances.

Random Forest¶

Predict using an ensemble of decision trees.
Signals¶
Inputs:
Data
A data set
Preprocessor
Preprocessing method(s)
Outputs:
Learner
A random forest learning algorithm with settings as specified in the dialog.
Model
A trained model. Output signal sent only if input Data is present.
Description¶
Random forest is an ensemble learning method used for classification, regression and other tasks. It was first proposed by Tin Kam Ho and further developed by Leo Breiman (Breiman, 2001) and Adele Cutler.
Random Forest builds a set of decision trees. Each tree is developed from a bootstrap sample from the training data. When developing individual trees, an arbitrary subset of attributes is drawn (hence the term “Random”), from which the best attribute for the split is selected. The final model is based on the majority vote from individually developed trees in the forest.
Random Forest works for both classification and regression tasks.
- Specify the name of the model. The default name is “Random Forest”.
- Specify how many decision trees will be included in the forest (Number of trees in the forest), and how many attributes will be arbitrarily drawn for consideration at each node. If the latter is not specified (option Number of attributes... left unchecked), this number is equal to the square root of the number of attributes in the data. You can also choose to fix the seed for tree generation (Fixed seed for random generator), which enables replicability of the results.
- Original Brieman’s proposal is to grow the trees without any pre-prunning, but since pre-pruning often works quite well and is faster, the user can set the depth to which the trees will be grown (Limit depth of individual trees). Another pre-pruning option is to select the smallest subset that can be split (Do not split subsets smaller than).
- Produce a report.
- Click Apply to communicate the changes to other widgets. Alternatively, tick the box on the left side of the Apply button and changes will be communicated automatically.
Examples¶
For classification tasks, we use iris data set. Connect it to Predictions. Then, connect File to Random Forest and Tree and connect them further to Predictions. Finally, observe the predictions for the two models.

For regressions tasks, we will use housing data. Here, we will compare different models, namely Random Forest, Linear Regression and Constant, in the Test&Score widget.

Save Model¶

Save a trained model to an output file.
Description¶
- Choose from previously saved models.
- Save the created model with the Browse icon. Click on the icon and enter the name of the file. The model will be saved to a pickled file.

- Save the model.
Example¶
When you want to save a custom-set model, feed the data to the model (e.g. Logistic Regression) and connect it to Save Model. Name the model; load it later into workflows with Load Model. Data sets used with Load Model have to contain compatible attributes.

SVM¶

Support Vector Machines map inputs to higher-dimensional feature spaces.
Signals¶
Inputs:
Data
A data set.
Preprocessor
Preprocessing method(s)
Outputs:
Learner
A support vector machine learning algorithm with settings as specified in the dialog.
Model
A trained model. Output signal sent only if input Data is present.
Support Vectors
A subset of data instances from the training set that were used as support vectors in the trained model.
Description¶
Support vector machine (SVM) is a machine learning technique that separates the attribute space with a hyperplane, thus maximizing the margin between the instances of different classes or class values. The technique often yields supreme predictive performance results. Orange embeds a popular implementation of SVM from the LIBSVM package. This widget is its graphical user interface.
For regression tasks, SVM performs linear regression in a high dimension feature space using an ε-insensitive loss. Its estimation accuracy depends on a good setting of C, ε and kernel parameters. The widget outputs class predictions based on a SVM Regression.
The widget works for both classification and regression tasks.
The learner can be given a name under which it will appear in other widgets. The default name is “SVM”.
SVM type with test error settings. SVM and ν-SVM are based on different minimization of the error function. On the right side, you can set test error bounds:
SVM:
- Cost: penalty term for loss and applies for classification and regression tasks.
- ε: a parameter to the epsilon-SVR model, applies to regression tasks. Defines the distance from true values within which no penalty is associated with predicted values.
-
- Cost: penalty term for loss and applies only to regression tasks
- ν: a parameter to the ν-SVR model, applies to classification and regression tasks. An upper bound on the fraction of training errors and a lower bound of the fraction of support vectors.
Kernel is a function that transforms attribute space to a new feature space to fit the maximum-margin hyperplane, thus allowing the algorithm to create the model with:
- Linear
- Polynomial
- RBF and
- Sigmoid
kernels. Functions that specify the kernel are presented upon selecting them, and the constants involved are:
- g for the gamma constant in kernel function (the recommended value is 1/k, where k is the number of the attributes, but since there may be no training set given to the widget the default is 0 and the user has to set this option manually),
- c for the constant c0 in the kernel function (default 0), and
- d for the degree of the kernel (default 3).
Set permitted deviation from the expected value in Numerical Tolerance. Tick the box next to Iteration Limit to set the maximum number of iterations permitted.
Produce a report.
Click Apply to commit changes. If you tick the box on the left side of the Apply button, changes will be communicated automatically.
Examples¶
In the first (regression) example, we have used housing data set and split the data into two data subsets (Data Sample and Remaining Data) with Data Sampler. The sample was sent to SVM which produced a Model, which was then used in Predictions to predict the values in Remaining Data. A similar schema can be used if the data is already in two separate files; in this case, two File widgets would be used instead of the File - Data Sampler combination.

The second example shows how to use SVM in combination with Scatterplot. The following workflow trains a SVM model on iris data and outputs support vectors, which are those data instances that were used as support vectors in the learning phase. We can observe which are these data instances in a scatter plot visualization. Note that for the workflow to work correctly, you must set the links between widgets as demonstrated in the screenshot below.

References¶
CN2 Rule Induction¶

Induce rules from data using CN2 algorithm.
Signals¶
Inputs
Data
Data set.
Preprocessor
Preprocessing method(s)
Outputs
Learner
The CN2 learning algorithm with settings as specified in the dialog.
CN2 Rule Classifier
A trained model. Output signal sent only if input Data is present.
Description¶
The CN2 algorithm is a classification technique designed for the efficient induction of simple, comprehensible rules of form “if cond then predict class”, even in domains where noise may be present.
CN2 Rule Induction works only for classification.
- Name under which the learner appears in other widgets. The default name is CN2 Rule Induction.
- Rule ordering:
- Ordered: induce ordered rules (decision list). Rule conditions are found and the majority class is assigned in the rule head.
- Unordered: induce unordered rules (rule set). Learn rules for each class individually, in regard to the original learning data.
- Covering algorithm:
- Exclusive: after covering a learning instance, remove it from further consideration.
- Weighted: after covering a learning instance, decrease its weight (multiplication by gamma) and in-turn decrease its impact on further iterations of the algorithm.
- Rule search:
- Evaluation measure: select a heuristic to evaluate found
hypotheses:
- Entropy (measure of unpredictability of content)
- Laplace Accuracy
- Weighted Relative Accuracy
- Beam width; remember the best rule found thus far and monitor a fixed number of alternatives (the beam).
- Evaluation measure: select a heuristic to evaluate found
hypotheses:
- Rule filtering:
- Minimum rule coverage: found rules must cover at least the minimum required number of covered examples. Unordered rules must cover this many target class examples.
- Maximum rule length: found rules may combine at most the maximum allowed number of selectors (conditions).
- Default alpha: significance testing to prune out most specialised (less frequently applicable) rules in regard to the initial distribution of classes.
- Parent alpha: significance testing to prune out most specialised (less frequently applicable) rules in regard to the parent class distribution.
- Tick ‘Apply Automatically’ to auto-communicate changes to other widgets and to immediately train the classifier if learning data is connected. Alternatively, press ‘Apply‘ after configuration.
Examples¶
For the example below, we have used zoo data set and passed it to CN2 Rule Induction. We can review and interpret the built model with CN2 Rule Viewer widget.

The second workflow tests evaluates CN2 Rule Induction and Tree in Test & Score.

References¶
- “Separate-and-Conquer Rule Learning”, Johannes Fürnkranz, Artificial Intelligence Review 13, 3-54, 1999
- “The CN2 Induction Algorithm”, Peter Clark and Tim Niblett, Machine Learning Journal, 3 (4), pp261-283, (1989)
- “Rule Induction with CN2: Some Recent Improvements”, Peter Clark and Robin Boswell, Machine Learning - Proceedings of the 5th European Conference (EWSL-91), pp151-163, 1991
- “Subgroup Discovery with CN2-SD”, Nada Lavrač et al., Journal of Machine Learning Research 5 (2004), 153-188, 2004
AdaBoost¶

An ensemble meta-algorithm that combines weak learners and adapts to the ‘hardness’ of each training sample.
Signals¶
Inputs:
Data
A data set.
Preprocessor
Preprocessing method(s)
Learner
A learning algorithm.
Outputs:
Learner
AdaBoost learning algorithm with settings as specified in the dialog.
Model
A trained model. Output signal sent only if input Data is present.
Description¶
The AdaBoost (short for “Adaptive boosting”) widget is a machine-learning algorithm, formulated by Yoav Freund and Robert Schapire. It can be used with other learning algorithms to boost their performance. It does so by tweaking the weak learners.
AdaBoost works for both classification and regression.
- The learner can be given a name under which it will appear in other widgets. The default name is “AdaBoost”.
- Set the parameters. The base estimator is a tree and you can set:
- Number of estimators
- Learning rate: it determines to what extent the newly acquired information will override the old information (0 = the agent will not learn anything, 1 = the agent considers only the most recent information)
- Fixed seed for random generator: set a fixed seed to enable reproducing the results.
- Boosting method.
- Classification algorithm (if classification on input): SAMME (updates base estimator’s weights with classification results) or SAMME.R (updates base estimator’s weight with probability estimates).
- Regression loss function (if regression on input): Linear (), Square (), Exponential ().
- Produce a report.
- Click Apply after changing the settings. That will put the new learner in the output and, if the training examples are given, construct a new model and output it as well. To communicate changes automatically tick Apply Automatically.
Examples¶
For classification, we loaded the iris data set. We used AdaBoost, Tree and Logistic Regression and evaluated the models’ performance in Test & Score.

For regression, we loaded the housing data set, sent the data instances to two different models (AdaBoost and Tree) and output them to the Predictions widget.

Stochastic Gradient Descent¶

Minimize an objective function using a stochastic approximation of gradient descent.
Signals¶
Inputs:
Data
A data set.
Preprocessor
Preprocessing method(s)
Outputs:
Learner
A SGD learning algorithm with settings as specified in the dialog.
Model
A trained model. Output signal sent only if input Data is present.
Description¶
The Stochastic Gradient Descent widget uses stochastic gradient descent that minimizes a chosen loss function with a linear function. The algorithm approximates a true gradient by considering one sample at a time, and simultaneously updates the model based on the gradient of the loss function. For regression, it returns predictors as minimizers of the sum, i.e. M-estimators, and is especially useful for large-scale and sparse data sets.
Specify the name of the model. The default name is “SGD”.
Algorithm parameters. Classification loss function:
- Hinge (linear SVM)
- Logistic Regression (logistic regression SGD)
- Modified Huber (smooth loss that brings tolerance to outliers as well as probability estimates)
- Squared Hinge (quadratically penalized hinge)
- Perceptron (linear loss used by the perceptron algorithm)
- Squared Loss (fitted to ordinary least-squares)
- Huber (switches to linear loss beyond ε)
- Epsilon insensitive (ignores errors within ε, linear beyond it)
- Squared epsilon insensitive (loss is squared beyond ε-region).
Regression loss function:
- Squared Loss (fitted to ordinary least-squares)
- Huber (switches to linear loss beyond ε)
- Epsilon insensitive (ignores errors within ε, linear beyond it)
- Squared epsilon insensitive (loss is squared beyond ε-region).
Regularization norms to prevent overfitting:
- None.
- Lasso (L1) (L1, leading to sparse solutions)
- Ridge (L2) (L2, standard regularizer)
- Elastic net (mixing both penalty norms).
Regularization strength defines how much regularization will be applied (the less we regularize, the more we allow the model to fit the data) and the mixing parameter what the ratio between L1 and L2 loss will be (if set to 0 then the loss is L2, if set to 1 then it is L1).
Learning parameters.
Learning rate:
- Constant: learning rate stays the same through all epochs (passes)
- Optimal: a heuristic proposed by Leon Bottou
- Inverse scaling: earning rate is inversely related to the number of iterations
Initial learning rate.
Inverse scaling exponent: learning rate decay.
Number of iterations: the number of passes through the training data.
If Shuffle data after each iteration is on, the order of data instances is mixed after each pass.
If Fixed seed for random shuffling is on, the algorithm will use a fixed random seed and enable replicating the results.
- Produce a report.
- Press Apply to commit changes. Alternatively, tick the box on the left side of the Apply button and changes will be communicated automatically.
Examples¶
For the classification task, we will use iris data set and test two models on it. We connected Stochastic Gradient Descent and Tree to Test & Score. We also connected File to Test & Score and observed model performance in the widget.

For the regression task, we will compare three different models to see which predict what kind of results. For the purpose of this example, the housing data set is used. We connect the File widget to Stochastic Gradient Descent, Linear Regression and kNN widget and all four to the Predictions widget.

Linear Regression¶

A linear regression algorithm with optional L1 (LASSO), L2 (ridge) or L1L2 (elastic net) regularization.
Signals¶
Inputs:
Data
A data set
Preprocessor
A preprocessed data set.
Outputs:
Learner
A linear regression learning algorithm with settings as specified in the dialog.
Predictor
A trained regressor. Output signal sent only if input Data is present.
Description¶
The Linear Regression widget constructs a learner/predictor that learns a linear function from its input data. The model can identify the relationship between a predictor xi and the response variable y. Additionally, Lasso and Ridge regularization parameters can be specified. Lasso regression minimizes a penalized version of the least squares loss function with L1-norm penalty and Ridge regularization with L2-norm penalty.
Linear regreesion works only on regression tasks.
- The learner/predictor name
- Choose a model to train:
- no regularization
- a Ridge regularization (L2-norm penalty)
- a Lasso bound (L1-norm penalty)
- an Elastic net regularization
- Produce a report.
- Press Apply to commit changes. If Apply Automatically is ticked, changes are committed automatically.
Example¶
Below, is a simple workflow with housing data set. We trained Linear Regression and Random Forest and evaluated their performance in Test&Score.

Unsupervised¶
PCA¶

PCA linear transformation of input data.
Description¶
Principal Component Analysis (PCA) computes the PCA linear transformation of the input data. It outputs either a transformed data set with weights of individual instances or weights of principal components.

- Select how many principal components you wish in your output. It is best to choose as few as possible with variance covered as high as possible. You can also set how much variance you wish to cover with your principal components.
- You can normalize data to adjust the values to common scale.
- When Apply Automatically is ticked, the widget will automatically communicate all changes. Alternatively, click Apply.
- Press Save Image if you want to save the created image to your computer.
- Produce a report.
- Principal components graph, where the red (lower) line is the variance covered per component and the green (upper) line is cumulative variance covered by components.
The number of components of the transformation can be selected either in the Components Selection input box or by dragging the vertical cutoff line in the graph.
Examples¶
PCA can be used to simplify visualizations of large data sets. Below, we used the Iris data set to show how we can improve the visualization of the data set with PCA. The transformed data in the Scatter Plot show a much clearer distinction between classes than the default settings.

The widget provides two outputs: transformed data and principal components. Transformed data are weights for individual instances in the new coordinate system, while components are the system descriptors (weights for princial components). When fed into the Data Table, we can see both outputs in numerical form. We used two data tables in order to provide a more clean visualization of the workflow, but you can also choose to edit the links in such a way that you display the data in just one data table. You only need to create two links and connect the Transformed data and Components inputs to the Data output.

Correspondence Analysis¶

Description¶
Correspondence Analysis (CA) computes the CA linear transformation of the input data. While it is similar to PCA, CA computes linear transformation on discrete rather than on continuous data.

- Select the variables you want to see plotted.
- Select the component for each axis.
- Inertia values (percentage of independence from transformation, i.e. variables are in the same dimension).
- Produce a report.
Example¶
Below, is a simple comparison between the Correspondence Analysis and Scatter plot widgets on the Titanic data set. While the Scatter plot shows fairly well which class and sex had a good survival rate and which one didn’t, Correspondence Analysis can plot several variables in a 2-D graph, thus making it easy to see the relations between variable values. It is clear from the graph that “no”, “male” and “crew” are related to each other. The same goes for “yes”, “female” and “first”.

Distance Map¶

Visualizes distances between items.
Signals¶
Inputs:
Distances
A distance matrix.
Outputs:
Data
Instances corresponding to the selected elements of the matrix.
Features
Attributes corresponding to the selected elements of the matrix.
Description¶
The Distance Map visualizes distances between objects. The visualization is the same as if we printed out a table of numbers, except that the numbers are replaced by colored spots.
Distances are most often those between instances (“rows” in the Distances widget) or attributes (“columns” in Distances widget). The only suitable input for Distance Map is the Distances widget. For the output, the user can select a region of the map and the widget will output the corresponding instances or attributes. Also note that the Distances widget ignores discrete values and calculates distances only for continuous data, thus it can only display distance map for discrete data if you Continuize them first.
The snapshot shows distances between columns in the heart disease data, where smaller distances are represented with light and larger with dark orange. The matrix is symmetric and the diagonal is a light shade of orange - no attribute is different from itself. Symmetricity is always assumed, while the diagonal may also be non-zero.

- Element sorting arranges elements in the map by
- None (lists instances as found in the data set)
- Clustering (clusters data by similarity)
- Clustering with ordered leaves (maximizes the sum of similarities of adjacent elements)
- Colors
- Colors (select the color palette for your distance map)
- Low and High are thresholds for the color palette (low for instances or attributes with low distances and high for instances or attributes with high distances).
- Select Annotations.
- If Send Selected Automatically is on, the data subset is communicated automatically, otherwise you need to press Send Selected.
- Press Save Image if you want to save the created image to your computer.
- Produce a report.
Normally, a color palette is used to visualize the entire range of distances appearing in the matrix. This can be changed by setting the low and high threshold. In this way we ignore the differences in distances outside this interval and visualize the interesting part of the distribution.
Below, we visualized the most correlated attributes (distances by columns) in the heart disease data set by setting the color threshold for high distances to the minimum. We get a predominantly black square, where attributes with the lowest distance scores are represented by a lighter shade of the selected color schema (in our case: orange). Beside the diagonal line, we see that in our example ST by exercise and major vessels colored are the two attributes closest together.

The user can select a region in the map with the usual click-and-drag of the cursor. When a part of the map is selected, the widget outputs all items from the selected cells.
Examples¶
The first workflow shows a very standard use of the Distance Map widget. We select 70% of the original Iris data as our sample and view the distances between rows in Distance Map.

In the second example, we use the heart disease data again and select a subset of women only from the Scatter Plot. Then, we visualize distances between columns in the Distance Map. Since the subset also contains some discrete data, the Distances widget warns us it will ignore the discrete features, thus we will see only continuous instances/attributes in the map.

Distances¶

Computes distances between rows/columns in a data set.
Description¶
The Distances widget computes distances between rows or columns in a data set.

Choose whether to measure distances between rows or columns.
Choose the Distance Metric:
- Euclidean (“straight line”, distance between two points)
- Manhattan (the sum of absolute differences for all attributes)
- Cosine (the cosine of the angle between two vectors of an inner product space)
- Jaccard (the size of the intersection divided by the size of the union of the sample sets)
- Spearman (linear correlation between the rank of the values, remapped as a distance in a [0, 1] interval)
- Spearman absolute (linear correlation between the rank of the absolute values, remapped as a distance in a [0, 1] interval)
- Pearson (linear correlation between the values, remapped as a distance in a [0, 1] interval)
- Pearson absolute (linear correlation between the absolute values, remapped as a distance in a [0, 1] interval)
In case of missing values, the widget automatically imputes the average value of the row or the column.
Since the widget cannot compute distances between discrete and continuous attributes, it only uses continuous attributes and ignores the discrete ones. If you want to use discrete attributes, continuize them with the Continuize widget first.
Produce a report.
Tick Apply Automatically to automatically commit changes to other widgets. Alternatively, press ‘Apply‘.
Example¶
This widget needs to be connected to another widget to display results, for instance to Distance Map to visualize distances, Hierarchical Clustering to cluster the attributes, or MDS to visualize the distances in a plane.

Distance Matrix¶

Visualizes distance measures in a distance matrix.
Signals¶
Inputs:
Distances
A distance matrix.
Outputs:
Distances
A distance matrix.
Table
Distance measures in a distance matrix.
Description¶
The Distance Matrix widget creates a distance matrix, which is a two-dimensional array containing the distances, taken pairwise, between the elements of a set. The number of elements in the data set defines the size of the matrix. Data matrices are essential for hierarchical clustering and they are extremely useful in bioinformatics as well, where they are used to represent protein structures in a coordinate-independent manner.

- Elements in the data set and the distances between them
- Label the table. The options are: none, enumeration, according to variables.
- Produce a report.
- Click Send to communicate changes to other widgets. Alternatively, tick the box in front of the Send button and changes will be communicated automatically (Send Automatically).
The only two suitable inputs for Distance Matrix are the Distances widget and the Distance Transformation widget. The output of the widget is a data table containing the distance matrix. The user can decide how to label the table and the distance matrix (or instances in the distance matrix) can then be visualized or displayed in a separate data table.
Example¶
The example below displays a very standard use of the Distance Matrix widget. We compute the distances between rows in the sample from the Iris data set and output them in the Distance Matrix. It comes as no surprise that Iris Virginica and Iris Setosa are the furthest apart.

Distance Transformation¶

Transforms distances in a data set.
Description¶
The Distances Transformation widget is used for the normalization and inversion of distance matrices. The normalization of data is necessary to bring all the variables into proportion with one another.

- Choose the type of Normalization:
- No normalization
- To interval [0, 1]
- To interval [-1, 1]
- Sigmoid function: 1/(1+exp(-X))
- Choose the type of Inversion:
- No inversion
- -X
- 1 - X
- max(X) - X
- 1/X
- Produce a report.
- After changing the settings, you need to click Apply to commit changes to other widgets. Alternatively, tick Apply automatically.
Example¶
In the snapshot below, you can see how transformation affects the distance matrix. We loaded the Iris data set and calculated the distances between rows with the help of the Distances widget. In order to demonstrate how Distance Transformation affects the Distance Matrix, we created the worflow below and compared the transformed distance matrix with the “original” one.

Distance File¶

Loads an existing distance file.
Description¶

- Choose from a list of previously saved distance files.
- Browse for saved distance files.
- Reload the selected distance file.
- Information about the distance file (number of points, labelled/unlabelled)
- Browse documentation data sets.
- Produce a report.
Example¶
When you want to use a custom-set distance file that you’ve saved before, open the Distance File widget and select the desired file with the Browse icon. This widget loads the existing distance file. In the snapshot below, we loaded the transformed Iris distance matrix from the Save Distance Matrix example. We displayed the transformed data matrix in the Distance Map widget. We also decided to display a distance map of the original Iris data set for comparison.

Save Distance Matrix¶

Saves a distance matrix.
Description¶

- By clicking Save, you choose from previously saved distance matrices. Alternatively, tick the box on the left side of the Save button and changes will be communicated automatically.
- By clicking Save as, you save the distance matrix to your computer, you only need to enter the name of the file and click Save. The distance matrix will be saved as type .dst.
Example¶
In the snapshot below, we used the Distance Transformation widget to transform the distances in the Iris data set. We then chose to save the transformed version to our computer, so we could use it later on. We decided to output all data instances. You can choose to output just a minor subset of the data matrix. Pairs are marked automatically. If you wish to know what happened to our changed file, go here

Hierarchical Clustering¶

Groups items using a hierarchical clustering algorithm.
Signals¶
Inputs:
Distances
A distance matrix
Outputs:
Selected Data
A data subset
Other Data
Remaining data
Description¶
The widget computes hierarchical clustering of arbitrary types of objects from a matrix of distances and shows a corresponding dendrogram.

- The widget supports four ways of measuring distances between
clusters:
- Single linkage computes the distance between the closest elements of the two clusters
- Average linkage computes the average distance between elements of the two clusters
- Weighted linkage uses the WPGMA method
- Complete linkage computes the distance between the clusters’ most distant elements
- Labels of nodes in the dendrogram can be chosen in the Annotation box.
- Huge dendrograms can be pruned in the Pruning box by selecting the maximum depth of the dendrogram. This only affects the display, not the actual clustering.
- The widget offers three different selection methods:
- Manual (Clicking inside the dendrogram will select a cluster. Multiple clusters can be selected by holding Ctrl/Cmd. Each selected cluster is shown in a different color and is treated as a separate cluster in the output.)
- Height ratio (Clicking on the bottom or top ruler of the dendrogram places a cutoff line in the graph. Items to the right of the line are selected.)
- Top N (Selects the number of top nodes.)
- Use Zoom and scroll to zoom in or out.
- If the items being clustered are instances, they can be added a cluster index (Append cluster IDs). The ID can appear as an ordinary Attribute, Class attribute or a Meta attribute. In the second case, if the data already has a class attribute, the original class is placed among meta attributes.
- The data can be automatically output on any change (Auto send is on) or, if the box isn’t ticked, by pushing Send Data.
- Clicking this button produces an image that can be saved.
- Produce a report.
Examples¶
The workflow below shows the output of Hierarchical Clustering for the Iris data set in Data Table widget. We see that if we choose Append cluster IDs in hierarchical clustering, we can see an additional column in the Data Table named Cluster. This is a way to check how hierarchical clustering clustered individual instances.

In the second example, we loaded the Iris data set again, but this time we added the Scatter Plot, showing all the instances from the File widget, while at the same time receiving the selected instances signal from Hierarchical Clustering. This way we can observe the position of the selected cluster(s) in the projection.

k-Means¶

Groups items using the k-Means clustering algorithm.
Description¶
The widget applies the k-Means clustering algorithm to the data and outputs a new data set in which the cluster index is used as a class attribute. The original class attribute, if it exists, is moved to meta attributes. Scores of clustering results for various k are also shown in the widget.

Select the number of clusters.
- Fixed: algorithm clusters data in a specified number of clusters.
- Optimized: widget shows clustering scores for the selected cluster range.
- Silhouette (contrasts average distance to elements in the same cluster with the average distance to elements in other clusters)
- Inter-cluster distance (measures distances between clusters, normally between centroids)
- Distance to centroids (measures distances to the arithmetic means of clusters)
Select the initialization method (the way the algorithm begins clustering):
- k-Means++ (first center is selected randomly, subsequent are chosen from the remaining points with probability proportioned to squared distance from the closest center)
- Random initialization (clusters are assigned randomly at first and then updated with further iterations)
Re-runs (how many times the algorithm is run) and maximal iterations (the maximum number of iteration within each algorithm run) can be set manually.
The widget outputs a new data set with appended cluster information. Select how to append cluster information (as class, feature or meta attribute) and name the column.
If Apply Automatically is ticked, the widget will commit changes automatically. Alternatively, click Apply.
Produce a report.
Check scores of clustering results for various k.
Examples¶
We are going to explore the widget with the following schema.

First, we load the Iris data set, divide it into three clusters and show it in the Data Table, where we can observe which instance went into which cluster. The interesting parts are the Scatter Plot and Select Rows.
Since k-Means added the cluster index as a class attribute, the scatter plot will color the points according to the clusters they are in.

What we are really interested in is how well the clusters induced by the (unsupervised) clustering algorithm match the actual classes in the data. We thus take Select Rows widget, in which we can select individual classes and have the corresponding points marked in the scatter plot. The match is perfect for setosa, and pretty good for the other two classes.

You may have noticed that we left the Remove unused values/attributes and Remove unused classes in Select Rows unchecked. This is important: if the widget modifies the attributes, it outputs a list of modified instances and the scatter plot cannot compare them to the original data.
Perhaps a simpler way to test the match between clusters and the original classes is to use the Distributions widget.

The only (minor) problem here is that this widget only visualizes normal (and not meta) attributes. We solve this by using Select Columns: we reinstate the original class Iris as the class and put the cluster index among the attributes.
The match is perfect for setosa: all instances of setosa are in the third cluster (blue). 48 versicolors are in the second cluster (red), while two ended up in the first. For virginicae, 36 are in the first cluster and 14 in the second.

MDS¶

Multidimensional scaling (MDS) projects items onto a plane fitted to given distances between points.
Signals¶
Inputs:
Distances
A distance matrix
Data
A data set
Outputs:
Data
A data set with MDS coordinates.
Data subset
Selected data
Description¶
Multidimensional scaling is a technique which finds a low-dimensional (in our case a two-dimensional) projection of points, where it tries to fit distances between points as well as possible. The perfect fit is typically impossible to obtain since the data is high-dimensional or the distances are not Euclidean.
In the input, the widget needs either a data set or a matrix of distances. When visualizing distances between rows, you can also adjust the color of the points, change their shape, mark them, and output them upon selection.
The algorithm iteratively moves the points around in a kind of a simulation of a physical model: if two points are too close to each other (or too far away), there is a force pushing them apart (or together). The change of the point’s position at each time interval corresponds to the sum of forces acting on it.

- The widget redraws the projection during optimization. Optimization
is run automatically in the beginning and later by pushing Start.
- Max iterations: The optimization stops either when the projection changes only minimally at the last iteration or when a maximum number of iterations has been reached.
- Initialization: PCA (Torgerson) positions the initial points along principal coordinate axes. Random sets the initial points to a random position and then readjusts them.
- Refresh: Set how often you want to refresh the visualization. It can be at Every iteration, Every 5/10/25/50 steps or never (None). Setting a lower refresh interval makes the animation more visually appealing, but can be slow if the number of points is high.
- Defines how the points are visualized. These options are available only when visalizing distances between rows (selected in the Distances widget).
- Color: Color of points by attribute (gray for continuous, colored for discrete).
- Shape: Shape of points by attribute (only for discrete).
- Size: Set the size of points (Same size or select an attribute) or let the size depend on the value of the continuous attribute the point represents (Stress).
- Label: Discrete attributes can serve as a label.
- Symbol size: Adjust the size of the dots.
- Symbol opacity: Adjust the transparency level of the dots.
- Show similar pairs: Adjust the strength of network lines.
- Jitter: Set jittering to prevent the dots from overlapping.
- Adjust the graph with Zoom/Select. The arrow enables you to select data instances. The magnifying glass enables zooming, which can be also done by scrolling in and out. The hand allows you to move the graph around. The rectangle readjusts the graph proportionally.
- Select the desired output:
- Original features only (input data set)
- Coordinates only (MDS coordinates)
- Coordinates as features (input data set + MDS coordinates as regular attributes)
- Coordinates as meta attributes (input data set + MDS coordinates as meta attributes)
- Sending the instances can be automatic if Send selected automatically is ticked. Alternatively, click Send selected.
- Save Image allows you to save the created image either as .svg or .png file to your device.
- Produce a report.
The MDS graph performs many of the functions of the Visualizations widget. It is in many respects similar to the Scatter Plot widget, so we recommend reading that widget’s description as well.
Example¶
The above graphs were drawn using the following simple schema. We used the iris.tab data set. Using the Distances widget we input the distance matrix into the MDS widget, where we see the Iris data displayed in a 2-dimensional plane. We can see the appended coordinates in the Data Table widget.

Manifold Learning¶

Nonlinear dimensionality reduction.
Signals¶
Inputs:
Data
A data set
Outputs:
Transformed Data
A data set with new, reduced coordinates.
Description¶
Manifold Learning is a technique which finds a non-linear manifold within the higher-dimensional space. The widget then outputs new coordinates which correspond to a two-dimensional space. Such data can be later visualized with Scatter Plot or other visualization widgets.

- Method for manifold learning:
- Set parameters for the method:
- t-SNE (distance measures):
- Euclidean distance
- Manhattan
- Chebyshev
- Jaccard
- Mahalanobis
- Cosine
- MDS (iterations and initialization):
- max interations: maximum number of optimization interations
- initialization: method for initialization of the algorithm (PCA or random)
- Isomap:
- number of neighbors
- Locally Linear Embedding:
- method:
- standard
- modified
- hessian eigenmap
- local
- number of neighbors
- max iterations
- Spectral Embedding:
- affinity:
- nearest neighbors
- RFB kernel
- Output: the number of reduced features (components).
- If Apply automatically is ticked, changes will be propagated automatically. Alternatively, click Apply.
- Produce a report.
Manifold Learning widget produces different embeddings for high-dimensional data.
... figure:: images/collage-manifold.png
From left to right, top to bottom: t-SNE, MDS, Isomap, Locally Linear Embedding and Spectral Embedding.
Example¶
Manifold Learning widget transforms high-dimensional data into a lower dimensional approximation. This makes it great for visualizing data sets with many features. We used voting.tab to map 16-dimensional data onto a 2D graph. Then we used Scatter Plot to plot the embeddings.

Evaluation¶
Calibration Plot¶

Shows the match between classifiers’ probability predictions and actual class probabilities.
Description¶
The Calibration Plot plots class probabilities against those predicted by the classifier(s).

- Select the desired target class from the drop down menu.
- Choose which classifiers to plot. The diagonal represents optimal behaviour; the closer the classifier’s curve gets, the more accurate its prediction probabilities are. Thus we would use this widget to see whether a classifier is overly optimistic (gives predominantly positive results) or pesimitistic (gives predominantly negative results).
- If Show rug is enabled, ticks are displayed at the bottom and the top of the graph, which represent negative and positive examples respectively. Their position corresponds to the classifier’s probability prediction and the color shows the classifier. At the bottom of the graph, the points to the left are those which are (correctly) assigned a low probability of the target class, and those to the right are incorrectly assigned high probabilities. At the top of the graph, the instances to the right are correctly assigned high probabilities and vice versa.
- Press Save Image if you want to save the created image to your computer in a .svg or .png format.
- Produce a report.
Example¶
At the moment, the only widget which gives the right type of signal needed by the Calibration Plot is Test&Score. The Calibration Plot will hence always follow Test&Score and, since it has no outputs, no other widgets follow it.
Here is a typical example, where we compare three classifiers (namely Naive Bayes, Tree and Constant) and input them into Test&Score. We used the Titanic data set. Test&Score then displays evaluation results for each classifier. Then we draw Calibration Plot and ROC Analysis widgets from Test&Score to further analyze the performance of classifiers. Calibration Plot enables you to see prediction accuracy of class probabilities in a plot.

Confusion Matrix¶

Shows proportions between the predicted and actual class.
Signals¶
Inputs:
Evaluation results
Results of testing the algorithms; typically from Test Learners
Outputs:
Selected Data
A data subset from the selected cells in the confusion matrix.
Description¶
The Confusion Matrix gives the number/proportion of instances between the predicted and actual class. The selection of the elements in the matrix feeds the corresponding instances into the output signal. This way, one can observe which specific instances were misclassified and how.
The widget usually gets the evaluation results from Test & Score; an example of the schema is shown below.

- When evaluation results contain data on multiple learning algorithms, we have to choose one in the Learners box.
The snapshot shows the confusion matrix for Tree and Naive Bayesian models trained and tested on the iris data. The righthand side of the widget contains the matrix for the naive Bayesian model (since this model is selected on the left). Each row corresponds to a correct class, while columns represent the predicted classes. For instance, four instances of Iris-versicolor were misclassified as Iris-virginica. The rightmost column gives the number of instances from each class (there are 50 irises of each of the three classes) and the bottom row gives the number of instances classified into each class (e.g., 48 instances were classified into virginica).
In Show, we select what data we would like to see in the matrix.
- Number of instances shows correctly and incorrectly classified instances numerically.
- Proportions of predicted shows how many instances classified as, say, Iris-versicolor are in which true class; in the table we can read the 0% of them are actually setosae, 88.5% of those classified as versicolor are versicolors, and 7.7% are virginicae.
- Proportions of actual shows the opposite relation: of all true versicolors, 92% were classified as versicolors and 8% as virginicae.
In Select, you can choose the desired output.
Correct sends all correctly classified instances to the output by selecting the diagonal of the matrix.
Misclassified selects the misclassified instances.
None annuls the selection.
As mentioned before, one can also select individual cells of the table to select specific kinds of misclassified instances (e.g. the versicolors classified as virginicae).
When sending selected instances, the widget can add new attributes, such as predicted classes or their probabilities, if the corresponding options Predictions and/or Probabilities are checked.
The widget outputs every change if Send Automatically is ticked. If not, the user will need to click Send Selected to commit the changes.
Produce a report.
Example¶
The following workflow demonstrates what this widget can be used for.

Test & Score gets the data from File and two learning algorithms from Naive Bayes and Tree. It performs cross-validation or some other train-and-test procedures to get class predictions by both algorithms for all (or some) data instances. The test results are fed into the Confusion Matrix, where we can observe how many instances were misclassified and in which way.
In the output, we used Data Table to show the instances we selected in the confusion matrix. If we, for instance, click Misclassified, the table will contain all instances which were misclassified by the selected method.
The Scatterplot gets two sets of data. From the File widget it gets the complete data, while the confusion matrix sends only the selected data, misclassifications for instance. The scatter plot will show all the data, with bold symbols representing the selected data.

Lift Curve¶

Measures the performance of a chosen classifier against a random classifier.
Description¶
The Lift curve shows the relation between the number of instances which were predicted positive and those that are indeed positive and thus measures the performance of a chosen classifier against a random classifier. The graph is constructed with the cumulative number of cases (in descending order of probability) on the x-axis and the cumulative number of true positives on the y-axis. Lift curve is often used in segmenting the population, e.g., plotting the number of responding customers against the number of all customers contacted. You can also determine the optimal classifier and its threshold from the graph.

- Choose the desired Target class. The default class is chosen alphabetically.
- If test results contain more than one classifier, the user can choose which curves she or he wants to see plotted. Click on a classifier to select or deselect the curve.
- Show lift convex hull plots a convex hull over lift curves for all classifiers (yellow curve). The curve shows the optimal classifier (or combination thereof) for each desired TP/P rate.
- Press Save Image if you want to save the created image to your computer in a .svg or .png format.
- Produce a report.
- 2-D pane with P rate (population) as x-axis and TP rate (true positives) as a y-axis. The diagonal line represents the behaviour of a random classifier. Click and drag to move the pane and scroll in or out to zoom. Click on the “A” sign at the bottom left corner to realign the pane.
Note
The perfect classifier would have a steep slope towards 1 until all classes are guessed correctly and then run straight along 1 on y-axis to (1,1).
Example¶
At the moment, the only widget which gives the right type of the signal needed by the Lift Curve is Test&Score.
In the example below, we try to see the prediction quality for the class ‘survived’ on the Titanic data set. We compared three different classifiers in the Test Learners widget and sent them to Lift Curve to see their performance against a random model. We see the Tree classifier is the best out of the three, since it best aligns with lift convex hull. We also see that its performance is the best for the first 30% of the population (in order of descending probability), which we can set as the threshold for optimal classification.

Predictions¶

Shows models’ predictions on the data.
Signals¶
Inputs
Data
A data set.
Predictors
Predictors to be used on the data.
Outputs
Predictions
Original data with added predictions.
Description¶
The widget receives a data set and one or more predictors (classifiers, not learning algorithms - see the example below). It outputs the data and the predictions.

- Information on the input
- The user can select the options for classification. If Show predicted class is ticked, the appended data table provides information on predicted class. If Show predicted probabilities is ticked, the appended data table provides information on probabilities predicted by the classifiers. The user can also select the predicted class he or she wants displayed in the appended data table. The option Draw distribution bars provides a nice visualization of the predictions.
- By ticking the Show full data set, the user can append the entire data table to the Predictions widget.
- Select the desired output.
- The appended data table
- Produce a report.
Despite its simplicity, the widget allows for quite an interesting analysis of decisions of predictive models; there is a simple demonstration at the bottom of the page. Confusion Matrix is a related widget and although many things can be done with any of them, there are tasks for which one of them might be much more convenient than the other. The output of the widget is another data set, where predictions are appended as new meta attributes. You can select which features you wish to output (original data, predictions, probabilities). The resulting data set can be appended to the widget, but you can still choose to display it in a separate data table.
Example¶

We randomly split the heart-disease data into two subsets. The larger subset, containing 70 % of data instances, is sent to Naive Bayes and Tree, so they can produce the corresponding model. Models are then sent into Predictions, among with the remaining 30 % of the data. Predictions shows how these examples are classified.
To save the predictions, we simply attach the Save widget to Predictions. The final file is a data table and can be saved as in a .tab or .tsv format.
Finally, we can analyze the models’ predictions. For that, we first take Select Columns with which we move the meta attributes with probability predictions to features. The transformed data is then given to the Scatterplot, which we set to use the attributes with probabilities as the x and y axes, while the class is (already by default) used to color the data points.

To get the above plot, we selected Jitter continuous values, since the decision tree gives just a few distinct probabilities. The blue points in the bottom left corner represent the people with no diameter narrowing, which were correctly classified by both models. The upper right red points represent the patients with narrowed vessels, which were correctly classified by both.
Note that this analysis is done on a rather small sample, so these conclusions may be ungrounded. Here is the entire workflow:

Another example of using this widget is given in the documentation for the widget Confusion Matrix.
ROC Analysis¶

Plots a true positive rate against a false positive rate of a test.
Description¶
The widget shows ROC curves for the tested models and the corresponding convex hull. It serves as a mean of comparison between classification models. The curve plots a false positive rate on an x-axis (1-specificity; probability that target=1 when true value=0) against a true positive rate on a y-axis (sensitivity; probability that target=1 when true value=1). The closer the curve follows the left-hand border and then the top border of the ROC space, the more accurate the classifier. Given the costs of false positives and false negatives, the widget can also determine the optimal classifier and threshold.

Choose the desired Target Class. The default class is chosen alphabetically.
If test results contain more than one classifier, the user can choose which curves she or he wants to see plotted. Click on a classifier to select or deselect it.
When the data comes from multiple iterations of training and testing, such as k-fold cross validation, the results can be (and usually are) averaged.
The averaging options are:
- Merge predictions from folds (top left), which treats all the test data as if they came from a single iteration
- Mean TP rate (top right) averages the curves vertically, showing the corresponding confidence intervals
- Mean TP and FP at threshold (bottom left) traverses over threshold, averages the positions of curves and shows horizontal and vertical confidence intervals
- Show individual curves (bottom right) does not average but prints all the curves instead
Option Show convex ROC curves refers to convex curves over each individual classifier (the thin lines positioned over curves). Show ROC convex hull plots a convex hull combining all classifiers (the gray area below the curves). Plotting both types of convex curves makes sense since selecting a threshold in a concave part of the curve cannot yield optimal results, disregarding the cost matrix. Besides, it is possible to reach any point on the convex curve by combining the classifiers represented by the points on the border of the concave region.
The diagonal dotted line represents the behaviour of a random classifier. The full diagonal line represents iso-performance. A black “A” symbol at the bottom of the graph proportionally readjusts the graph.
The final box is dedicated to the analysis of the curve. The user can specify the cost of false positives (FP) and false negatives (FN), and the prior target class probability.
Default threshold (0.5) point shows the point on the ROC curve achieved by the classifier if it predicts the target class if its probability equals or exceeds 0.5.
Show performance line shows iso-performance in the ROC space so that all the points on the line give the same profit/loss. The line further to the upper left is better than the one down and right. The direction of the line depends upon costs and probabilities. This gives a recipe for depicting the optimal threshold for the given costs: this is the point where the tangent with the given inclination touches the curve and it is marked in the plot. If we push the iso-performance higher or more to the left, the points on the iso-performance line cannot be reached by the learner. Going down or to the right, decreases the performance.
The widget allows setting the costs from 1 to 1000. Units are not important, as are not the magnitudes. What matters is the relation between the two costs, so setting them to 100 and 200 will give the same result as 400 and 800.
Defaults: both costs equal (500), Prior target class probability 50% (from the data).
False positive cost: 830, False negative cost 650, Prior target class probability 73%.
Press Save Image if you want to save the created image to your computer in a .svg or .png format.
Produce a report.
Example¶
At the moment, the only widget which gives the right type of signal needed by the ROC Analysis is Test&Score. Below, we compare two classifiers, namely Tree and Naive Bayes, in Test&Score and then compare their performance in ROC Analysis, Life Curve and Calibration Plot.

Test & Score¶

Tests learning algorithms on data.
Signals¶
Inputs
Data
Data for training and, if there is no separate test data set, also testing.
Test Data
Separate data for testing.
Learner
One or more learning algorithms.
Outputs
Evaluation results
Results of testing the algorithms.
Description¶
The widget tests learning algorithms. Different sampling schemes are available, including using separate test data. The widget does two things. First, it shows a table with different classifier performance measures, such as classification accuracy and area under the curve. Second, it outputs evaluation results, which can be used by other widgets for analyzing the performance of classifiers, such as ROC Analysis or Confusion Matrix.
The Learner signal has an uncommon property: it can be connected to more than one widget to test multiple learners with the same procedures.

- The widget supports various sampling methods.
- Cross-validation splits the data into a given number of folds (usually 5 or 10). The algorithm is tested by holding out examples from one fold at a time; the model is induced from other folds and examples from the held out fold are classified. This is repeated for all the folds.
- Leave-one-out is similar, but it holds out one instance at a time, inducing the model from all others and then classifying the held out instances. This method is obviously very stable, reliable … and very slow.
- Random sampling randomly splits the data into the training and testing set in the given proportion (e.g. 70:30); the whole procedure is repeated for a specified number of times.
- Test on train data uses the whole data set for training and then for testing. This method practically always gives wrong results.
- Test on test data: the above methods use the data from Data signal only. To input another data set with testing examples (for instance from another file or some data selected in another widget), we select Separate Test Data signal in the communication channel and select Test on test data.
- Only Test on test data requires a target class, e.g. having the disease or being of subvariety Iris setosa. When Target class is (None), the methods return the average value. Target class can be selected at the bottom of the widget.
- Produce a report.
- The widget will compute a number of performance statistics:
Classification¶

- Area under ROC is the area under the receiver-operating curve.
- Classification accuracy is the proportion of correctly classified examples.
- F-1 is a weighted harmonic mean of precision and recall (see below).
- Precision is the proportion of true positives among instances classified as positive, e.g. the proportion of Iris virginica correctly identified as Iris virginica.
- Recall is the proportion of true positives among all positive instances in the data, e.g. the number of sick among all diagnosed as sick.
Regression¶

- MSE measures the average of the squares of the errors or deviations (the difference between the estimator and what is estimated).
- RMSE is the square root of the arithmetic mean of the squares of a set of numbers (a measure of imperfection of the fit of the estimator to the data)
- MAE is used to measure how close forecasts or predictions are to eventual outcomes.
- R2 is interpreted as the proportion of the variance in the dependent variable that is predictable from the independent variable.
Example¶
In a typical use of the widget, we give it a data set and a few learning algorithms and we observe their performance in the table inside the Test & Score widget and in the ROC. The data is often preprocessed before testing; in this case we did some manual feature selection (Select Columns widget) on Titanic data set, where we want to know only the sex and status of the survived and omit the age.

Another example of using this widget is presented in the documentation for the Confusion Matrix widget.