## File: README.md

# Orange Data Mining
[Orange] is a data mining and visualization toolbox for novice and expert alike. To explore data with Orange, one requires __no programming or in-depth mathematical knowledge__. We believe that workflow-based data science tools democratize data science by hiding complex underlying mechanics and exposing intuitive concepts. Anyone who owns data, or is motivated to peek into data, should have the means to do so.



[Orange]: https://orange.biolab.si/


## Installing

### Easy installation

For easy installation, [Download](https://orange.biolab.si/download) the latest released Orange version from our website. To install an add-on, head to `Options -> Add-ons...` in the menu bar.

### Installing with Conda

First, install [Miniconda](https://docs.conda.io/en/latest/miniconda.html) for your OS. 

Then, create a new conda environment, and install orange3:

```Shell
# Add conda-forge to your channels for access to the latest release
conda config --add channels conda-forge

# Perhaps enforce strict conda-forge priority
conda config --set channel_priority strict

# Create and activate an environment for Orange
conda create python=3.12 --yes --name orange3
conda activate orange3

# Install Orange
conda install orange3
```

For installation of an add-on, use:
```Shell
conda install orange3-<addon name>
```
[See specific add-on repositories for details.](https://github.com/biolab/)


### Installing with pip

We recommend using our [standalone installer](https://orange.biolab.si/download) or conda, but Orange is also installable with pip. You will need a C/C++ compiler (on Windows we suggest using Microsoft Visual Studio Build Tools).
Orange needs PyQt to run. Install either:
- PyQt6 and PyQt6-WebEngine: `pip install PyQt6 PyQt6-WebEngine` (suggested)
- PyQt5 and PyQtWebEngine: `pip install PyQt5 PyQtWebEngine`

### Installing with winget (Windows only)

To install Orange with [winget](https://docs.microsoft.com/en-us/windows/package-manager/winget/), run:

```Shell
winget install --id  UniversityofLjubljana.Orange 
```

## Running

Ensure you've activated the correct virtual environment. If following the above conda instructions:

```Shell
conda activate orange3
``` 

Run `orange-canvas` or `python3 -m Orange.canvas`. Add `--help` for a list of program options.

Starting up for the first time may take a while.


## Developing

[](https://actions-badge.atrox.dev/biolab/orange3/goto) [](https://codecov.io/gh/biolab/orange3) [](https://github.com/biolab/orange3/graphs/contributors) [](https://github.com/biolab/orange3/commits/master)

Want to write a widget? [Use the Orange3 example add-on template.](https://github.com/biolab/orange3-example-addon)

Want to get involved? Join us on [Discord](https://discord.gg/FWrfeXV), introduce yourself in #general! 

Take a look at our [contributing guide](https://github.com/irgolic/orange3/blob/README-shields/CONTRIBUTING.md) and [style guidelines](https://github.com/biolab/orange-widget-base/wiki/Widget-UI).

Check out our widget development [docs](https://orange-widget-base.readthedocs.io/en/latest/?badge=latest) for a comprehensive guide on writing Orange widgets.

### The Orange ecosystem

The development of core Orange is primarily split into three repositories:

[biolab/orange-canvas-core](https://www.github.com/biolab/orange-canvas-core) implements the canvas,  
[biolab/orange-widget-base](https://www.github.com/biolab/orange-widget-base) is a handy widget GUI library,  
[biolab/orange3](https://www.github.com/biolab/orange3) brings it all together and implements the base data mining toolbox.	

Additionally, add-ons implement additional widgets for more specific use cases. [Anyone can write an add-on.](https://github.com/biolab/orange3-example-addon) Some of our first-party add-ons:

- [biolab/orange3-text](https://www.github.com/biolab/orange3-text)
- [biolab/orange3-bioinformatics](https://www.github.com/biolab/orange3-bioinformatics)
- [biolab/orange3-timeseries](https://www.github.com/biolab/orange3-timeseries)    
- [biolab/orange3-single-cell](https://www.github.com/biolab/orange3-single-cell)    
- [biolab/orange3-imageanalytics](https://www.github.com/biolab/orange3-imageanalytics)    
- [biolab/orange3-educational](https://www.github.com/biolab/orange3-educational)    
- [biolab/orange3-geo](https://www.github.com/biolab/orange3-geo)    
- [biolab/orange3-associate](https://www.github.com/biolab/orange3-associate)    
- [biolab/orange3-network](https://www.github.com/biolab/orange3-network)
- [biolab/orange3-explain](https://www.github.com/biolab/orange3-explain)

### Setting up for core Orange development

First, fork the repository by pressing the fork button in the top-right corner of this page.

Set your GitHub username,

```Shell
export MY_GITHUB_USERNAME=replaceme
```

create a conda environment, clone your fork, and install it:

```Shell
conda create python=3.12 --yes --name orange3
conda activate orange3

git clone ssh://git@github.com/$MY_GITHUB_USERNAME/orange3

# Install PyQt. This will install PyQt6; you can also use PyQt5
pip install -r orange3/requirements-pyqt.txt
pip install -e orange3
```

Now you're ready to work with git. See GitHub's guides on [pull requests](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests), [forks](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/working-with-forks) if you're unfamiliar. If you're having trouble, get in touch on [Discord](https://discord.gg/FWrfeXV).

#### Running

Run Orange with `python -m Orange.canvas` (after activating the conda environment).

`python -m Orange.canvas -l 2 --no-splash --no-welcome` will skip the splash screen and welcome window, and output more debug info. Use `-l 4` for more.

Add `--clear-widget-settings` to clear the widget settings before start.

To explore the dark side of the Orange, try `--style=fusion:breeze-dark`

Argument `--help` lists all available options.

To run tests, use `unittest Orange.tests Orange.widgets.tests`


### Setting up for development of all components

Should you wish to contribute Orange's base components (the widget base and the canvas), you must also clone these two repositories from Github instead of installing them as dependencies of Orange3.

First, fork all the repositories to which you want to contribute. 

Set your GitHub username,

```Shell
export MY_GITHUB_USERNAME=replaceme
```

create a conda environment, clone your forks, and install them:

```Shell
conda create python=3.12 --yes --name orange3
conda activate orange3

# Install PyQT and PyQtWebEngine. You can also use PyQt6
pip install -r requirements-pyqt.txt

git clone ssh://git@github.com/$MY_GITHUB_USERNAME/orange-widget-base
pip install -e orange-widget-base

git clone ssh://git@github.com/$MY_GITHUB_USERNAME/orange-canvas-core
pip install -e orange-canvas-core

git clone ssh://git@github.com/$MY_GITHUB_USERNAME/orange3
pip install -e orange3

# Repeat for any add-on repositories
```

It's crucial to install `orange-base-widget` and `orange-canvas-core` before `orange3` to ensure that `orange3` will use your local versions.

---

## File: doc/data-mining-library/source/reference/classification.rst

###################################
Classification (``classification``)
###################################

.. automodule:: Orange.classification

.. index:: logistic regression
   pair: classification; logistic regression

Logistic Regression
-------------------
.. autoclass:: LogisticRegressionLearner
   :members:



.. index:: random forest
   pair: classification; random forest

Random Forest
-------------
.. autoclass:: RandomForestLearner
   :members:



.. index:: random forest (simple)
   pair: classification; simple random forest

Simple Random Forest
--------------------

.. autoclass:: SimpleRandomForestLearner
   :members:



.. index:: softmax regression classifier
   pair: classification; softmax regression

Softmax Regression
------------------

.. autoclass:: SoftmaxRegressionLearner
   :members:


.. index:: k-nearest neighbors classifier
   pair: classification; k-nearest neighbors

k-Nearest Neighbors
-------------------
.. autoclass:: KNNLearner
   :members:


.. index:: naive Bayes classifier
   pair: classification; naive Bayes

Naive Bayes
-----------
.. autoclass:: NaiveBayesLearner
   :members:

The following code loads lenses dataset (four discrete attributes and discrete
class), constructs naive Bayesian learner, uses it on the entire dataset
to construct a classifier, and then applies classifier to the first three
data instances:

    >>> import Orange
    >>> lenses = Orange.data.Table('lenses')
    >>> nb = Orange.classification.NaiveBayesLearner()
    >>> classifier = nb(lenses)
    >>> classifier(lenses[0:3], True)
    array([[ 0.04358755,  0.82671726,  0.12969519],
           [ 0.17428279,  0.20342097,  0.62229625],
           [ 0.18633359,  0.79518516,  0.01848125]])

.. _`Naive Bayes`: http://en.wikipedia.org/wiki/Naive_Bayes_classifier
.. _`scikit-learn`: http://scikit-learn.org

.. index:: SVM
   pair: classification; SVM

Support Vector Machines
-----------------------
.. autoclass:: SVMLearner
   :members:


.. index:: SVM, linear
   pair: classification; linear SVM

Linear Support Vector Machines
------------------------------
.. autoclass:: LinearSVMLearner
   :members:



.. index:: Nu-SVM
   pair: classification; Nu-SVM

Nu-Support Vector Machines
--------------------------
.. autoclass:: NuSVMLearner
   :members:


.. index:: classification tree
   pair: classification; tree

Classification Tree
-------------------

Orange includes three implemenations of classification trees. `TreeLearner`
is home-grown and properly handles multinominal and missing values.
The one from scikit-learn, `SklTreeLearner`, is faster. Another home-grown,
`SimpleTreeLearner`, is simpler and still faster.

The following code loads iris dataset (four numeric attributes and discrete
class), constructs a decision tree learner, uses it on the entire dataset
to construct a classifier, and then prints the tree:

    >>> import Orange
    >>> iris = Orange.data.Table('iris')
    >>> tr = Orange.classification.TreeLearner()
    >>> classifier = tr(data)
    >>> printed_tree = classifier.print_tree()
    >>> for i in printed_tree.split('\n'):
    >>>     print(i)
    [50.  0.  0.] petal length ≤ 1.9
    [ 0. 50. 50.] petal length > 1.9
    [ 0. 49.  5.]     petal width ≤ 1.7
    [ 0. 47.  1.]         petal length ≤ 4.9
       [0. 2. 4.]         petal length > 4.9
       [0. 0. 3.]             petal width ≤ 1.5
       [0. 2. 1.]             petal width > 1.5
       [0. 2. 0.]                 sepal length ≤ 6.7
       [0. 0. 1.]                 sepal length > 6.7
    [ 0.  1. 45.]     petal width > 1.7

.. autoclass:: TreeLearner
   :members:

.. autoclass:: SklTreeLearner
   :members:

.. index:: classification tree (simple)
   pair: classification; simple tree

Simple Tree
-----------
.. autoclass:: SimpleTreeLearner
   :members:



.. index:: majority classifier
   pair: classification; majority

Majority Classifier
-------------------

.. autoclass:: MajorityLearner
   :members:


.. index:: neural network
   pair: classification; neural network

Neural Network
--------------
.. autoclass:: NNClassificationLearner
   :members:


.. index:: Rule induction
   pair: classification; rules

CN2 Rule Induction
------------------

.. automodule:: Orange.classification.rules

.. autoclass:: CN2Learner
   :members:

.. autoclass:: CN2UnorderedLearner
   :members:

.. autoclass:: CN2SDLearner
   :members:

.. autoclass:: CN2SDUnorderedLearner
   :members:


Calibration and threshold optimization
--------------------------------------

.. automodule:: Orange.classification.calibration

.. autoclass:: ThresholdClassifier
   :members:

.. autoclass:: ThresholdLearner
   :members:

.. autoclass:: CalibratedClassifier
   :members:

.. autoclass:: CalibratedLearner
   :members:


Gradient Boosted Trees
----------------------

.. automodule:: Orange.classification.gb

.. autoclass:: GBClassifier
   :members:

.. automodule:: Orange.classification.catgb

.. autoclass:: CatGBClassifier
   :members:

.. automodule:: Orange.classification.xgb

.. autoclass:: XGBClassifier
   :members:

.. autoclass:: XGBRFClassifier
   :members:

---

## File: doc/data-mining-library/source/reference/clustering.hierarchical.rst

.. py:currentmodule:: Orange.clustering.hierarchical

###############################
Hierarchical (``hierarchical``)
###############################

.. index:: hierarchical clustering
   pair: clustering; hierarchical clustering

Example
=======

The following example shows clustering of the Iris data with distance
matrix computed with the :obj:`Orange.distance.Euclidean` distance
and clustering using average linkage.

    >>> from Orange import data, distance
    >>> from Orange.clustering import hierarchical
    >>> data = data.Table('iris')
    >>> dist_matrix = distance.Euclidean(data)
    >>> hierar = hierarchical.HierarchicalClustering(n_clusters=3)
    >>> hierar.linkage = hierarchical.AVERAGE
    >>> hierar.fit(dist_matrix)
    >>> hierar.labels
    array([ 1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
            1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
            1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,
            1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  1.,  0.,  0.,
            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
            0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  2.,  0.,  2.,  2.,
            2.,  2.,  0.,  2.,  2.,  2.,  2.,  2.,  2.,  0.,  0.,  2.,  2.,
            2.,  2.,  0.,  2.,  0.,  2.,  0.,  2.,  2.,  0.,  0.,  2.,  2.,
            2.,  2.,  2.,  0.,  2.,  2.,  2.,  2.,  0.,  2.,  2.,  2.,  0.,
            2.,  2.,  2.,  0.,  2.,  2.,  0.])


Hierarchical Clustering
-----------------------

.. autoclass:: HierarchicalClustering
   :members:

---

## File: doc/data-mining-library/source/reference/clustering.rst

###########################
Clustering (``clustering``)
###########################

.. automodule:: Orange.clustering

.. toctree::
   :maxdepth: 2

   clustering.hierarchical

---

## File: doc/data-mining-library/source/reference/data.domain.rst

.. currentmodule:: Orange.data

###############################
Domain description (``domain``)
###############################

Description of a domain stores a list of features, class(es) and meta
attribute descriptors. A domain descriptor is attached to all tables in
Orange to assign names and types to the corresponding columns. Columns in
the :obj:`Orange.data.Table` have the roles of attributes (features,
independent variables), class(es) (targets, outcomes, dependent variables)
and meta attributes; in parallel to that, the domain descriptor stores
their corresponding
descriptions in collections of variable descriptors of type
:obj:`Orange.data.Variable`.

Domain descriptors are also stored in predictive models and other objects to
facilitate automated conversions between domains, as described below.

Domains are most often constructed automatically when loading the data or
wrapping the numpy arrays into Orange's :obj:`~Orange.data.Table`. ::

    >>> from Orange.data import Table
    >>> iris = Table("iris")
    >>> iris.domain
    [sepal length, sepal width, petal length, petal width | iris]

.. autoclass:: Orange.data.Domain

    .. attribute:: attributes

        A tuple of descriptors (instances of :class:`Orange.data.Variable`)
        for attributes (features, independent variables). ::

            >>> iris.domain.attributes
            (ContinuousVariable('sepal length'), ContinuousVariable('sepal width'),
            ContinuousVariable('petal length'), ContinuousVariable('petal width'))

    .. attribute:: class_var

        Class variable if the domain has a single class; `None` otherwise. ::

            >>> iris.domain.class_var
            DiscreteVariable('iris')

    .. attribute:: class_vars

        A tuple of descriptors for class attributes (outcomes, dependent
        variables). ::

            >>> iris.domain.class_vars
            (DiscreteVariable('iris'),)

    .. attribute:: variables

        A list of attributes and class attributes (the concatenation of
        the above). ::

            >>> iris.domain.variables
            (ContinuousVariable('sepal length'), ContinuousVariable('sepal width'),
            ContinuousVariable('petal length'), ContinuousVariable('petal width'),
            DiscreteVariable('iris'))

    .. attribute:: metas

        List of meta attributes.

    .. attribute:: anonymous

        `True` if the domain was constructed when converting numpy array to
        :class:`Orange.data.Table`. Such domains can be converted to and
        from other domains even if they consist of different variable
        descriptors for as long as their number and types match.

    .. automethod:: Domain.__init__

        The following script constructs a domain with a discrete feature
        *gender* and continuous feature *age*, and a continuous target *salary*.
        ::

            >>> from Orange.data import Domain, DiscreteVariable, ContinuousVariable
            >>> domain = Domain([DiscreteVariable.make("gender"),
            ...                  ContinuousVariable.make("age")],
            ...                 ContinuousVariable.make("salary"))
            >>> domain
            [gender, age | salary]

        This constructs a new domain with some features from the Iris dataset
        and a new feature *color*. ::

            >>> new_domain = Domain(["sepal length",
            ...                      "petal length",
            ...                      DiscreteVariable.make("color")],
            ...                     iris.domain.class_var,
            ...                     source=iris.domain)
            >>> new_domain
            [sepal length, petal length, color | iris]

    .. automethod:: from_numpy

        ::

            >>> import numpy as np
            >>> from Orange.data import Domain
            >>> X = np.arange(20, dtype=float).reshape(5, 4)
            >>> Y = np.arange(5, dtype=int)
            >>> domain = Domain.from_numpy(X, Y)
            >>> domain
            [Feature 1, Feature 2, Feature 3, Feature 4 | Class 1]

    .. automethod:: __getitem__

        ::

            >>> iris.domain[1:3]
            (ContinuousVariable('sepal width'), ContinuousVariable('petal length'))

    .. automethod:: __len__
    .. automethod:: __contains__

        ::

            >>> "petal length" in iris.domain
            True
            >>> "age" in iris.domain
            False

    .. automethod:: index

        ::

            >>> iris.domain.index("petal length")
            2

    .. automethod:: has_discrete_attributes

        ::

            >>> iris.domain.has_discrete_attributes()
            False
            >>> iris.domain.has_discrete_attributes(include_class=True)
            True


    .. automethod:: has_continuous_attributes

        ::

            >>> iris.domain.has_continuous_attributes()
            True

Domain conversion
#################

    Domain descriptors also convert data instances between different domains.

    In a typical scenario, we may want to discretize some continuous data before
    inducing a model. Discretizers (:mod:`Orange.preprocess`)
    construct a new data table with attribute descriptors
    (:class:`Orange.data.variable`), that include the corresponding functions
    for conversion from continuous to discrete values. The trained model stores
    this domain descriptor and uses it to convert instances from the original
    domain to the discretized one at prediction phase.

    In general, instances are converted between domains as follows.

    - If the target attribute appears in the source domain, the value is
      copied; two attributes are considered the same if they have the same
      descriptor.
    - If the target attribute descriptor defines a function for value
      transformation, the value is transformed.
    - Otherwise, the value is marked as missing.

    An exception to this rule are domains in which the anonymous flag is set.
    When the source or the target domain is anonymous, they match if they have
    the same number of variables and types. In this case, the data is copied
    without considering the attribute descriptors.

---

## File: doc/data-mining-library/source/reference/data.filters.rst

.. currentmodule:: Orange.data

#########################
Data Filters (``filter``)
#########################

Instances of classes derived from `Filter` are used for filtering the data.

When called with an individual data instance (:obj:`Orange.data.Instance`),
they accept or reject the instance by returning either `True` or `False`.

When called with a data storage (e.g. an instance of
:obj:`Orange.data.Table`) they check whether the corresponding class
provides the method that implements the particular filter. If so, the
method is called and the result should be of the same type as the
storage; e.g., filter methods of :obj:`Orange.data.Table` return new
instances of :obj:`Orange.data.Table`, and filter methods of SQL proxies
return new SQL proxies.

If the class corresponding to the storage does not implement a particular
filter, the fallback computes the indices of the rows to be selected and
returns `data[indices]`.


.. automodule:: Orange.data.filter
    :members:

---

## File: doc/data-mining-library/source/reference/data.instance.rst

.. currentmodule:: Orange.data

############################
Data Instance (``instance``)
############################

Class :obj:`Instance` represents a data instance, typically retrieved from a
:obj:`Orange.data.Table` or :obj:`Orange.data.sql.SqlTable`. The base class
contains a copy of the data; modifying does not change the data in the storage
from which the instance was retrieved. Derived classes
(e.g. :obj:`Orange.data.table.RowInstance`) can represent views into various
data storages, therefore changing them actually changes the data.

Like data tables, every data instance is associated with a domain and its
data is split into attributes, classes, meta attributes and the weight. Its
constructor thus requires a domain and, optionally, data. For the following
example, we borrow the domain from the Iris dataset. ::

    >>> from Orange.data import Table, Instance
    >>> iris = Table("iris")
    >>> inst = Instance(iris.domain, [5.2, 3.8, 1.4, 0.5, "Iris-virginica"])
    >>> inst
    [5.2, 3.8, 1.4, 0.5 | Iris-virginica]
    >>> inst0 = Instance(iris.domain)
    >>> inst0
    [?, ?, ?, ? | ?]

The instance's data can be retrieved through attributes :obj:`x`, :obj:`y` and
:obj:`metas`. ::

    >>> inst.x
    array([ 5.2,  3.8,  1.4,  0.5])
    >>> inst.y
    array([ 2.])
    >>> inst.metas
    array([], dtype=object)

Other utility functions provide for easier access to the instances data. ::

    >>> inst.get_class()
    Value('iris', Iris-virginica)
    >>> for e in inst.attributes():
    ...     print(e)
    ...
    5.2
    3.8
    1.4
    0.5

.. autoclass:: Instance
    :members:

    Constructor requires a domain and the data as numpy array, an existing
    instance from the same or another domain or any Python iterable.

    Domain can be omitted it the data is given as an existing data instances.

    When the instance is not from the given domain, Orange converts it.

        >>> from Orange.preprocess import DomainDiscretizer
        >>> discretizer = DomainDiscretizer()
        >>> d_iris = discretizer(iris)
        >>> d_inst = Instance(d_iris, inst)



Rows of Data Tables
-------------------

.. autoclass:: RowInstance
    :members:

    `RowInstance` is a specialization of :obj:`~Orange.data.Instance` that
    represents a row of :obj:`Orange.data.Table`. `RowInstance` is returned
    by indexing a `Table`.

    The difference between `Instance` and `RowInstance` is that the latter
    represents a view into the table: changing the `RowInstance` changes the
    data in the table::

        >>> iris[42]
        [4.4, 3.2, 1.3, 0.2 | Iris-setosa]
        >>> inst = iris[42]
        >>> inst.set_class("Iris-virginica")
        >>> iris[42]
        [4.4, 3.2, 1.3, 0.2 | Iris-virginica]

    Dense tables can also be modified directly through :obj:`x`, :obj:`y` and
    :obj:`metas`. ::

        >>> inst.x[0] = 5
        >>> iris[42]
        [5.0, 3.2, 1.3, 0.2 | Iris-virginica]

    Sparse tables cannot be changed in this way.

---

## File: doc/data-mining-library/source/reference/data.io.rst

.. py:currentmodule:: Orange.data.io

################################
Loading and saving data (``io``)
################################

:obj:`Orange.data.Table` supports loading from several file formats:

* Comma-separated values (\*.csv) file,
* Tab-separated values (\*.tab, \*.tsv) file,
* Excel spreadsheet (\*.xls, \*.xlsx),
* Python pickle.

In addition, the text-based files (CSV, TSV) can be compressed with gzip,
bzip2 or xz (e.g. \*.csv.gz).


Header Format
=============

The data in CSV, TSV, and Excel files can be described in an extended
three-line header format, or a condensed single-line header format.


Three-line header format
------------------------

A three-line header consists of:

1. **Feature names** on the first line. Feature names can include any combination
   of characters.

2. **Feature types** on the second line. The type is determined automatically,
   or, if set, can be any of the following:

   * ``discrete`` (or ``d``) — imported as :obj:`Orange.data.DiscreteVariable`,
   * a space-separated **list of discrete values**, like "``male female``",
     which will result in :obj:`Orange.data.DiscreteVariable` with those values
     and in that order. If the individual values contain a space character, it
     needs to be escaped (prefixed) with, as common, a backslash ('\\') character.
   * ``continuous`` (or ``c``) — imported as :obj:`Orange.data.ContinuousVariable`,
   * ``string`` (or ``s``, or ``text``) — imported as :obj:`Orange.data.StringVariable`,
   * ``time`` (or ``t``) — imported as :obj:`Orange.data.TimeVariable`, if the
     values parse as `ISO 8601 <https://en.wikipedia.org/wiki/ISO_8601>`_ date/time formats,

3. **Flags** (optional) on the third header line. Feature's flag can be empty,
   or it can contain, space-separated, a consistent combination of:

   * ``class`` (or ``c``) — feature will be imported as a class variable.
     Most algorithms expect a single class variable.
   * ``meta`` (or ``m``) — feature will be imported as a meta-attribute, just
     describing the data instance but not actually used for learning,
   * ``weight`` (or ``w``) — the feature marks the weight of examples (in
     algorithms that support weighted examples),
   * ``ignore`` (or ``i``) — feature will not be imported,
   * ``<key>=<value>`` are custom attributes recognized in specific contexts, for instance ``color``, which defines the color palette when the variable is visualized, or ``type=image`` which signals that the variable contains a path to an image.

Example of iris dataset in Orange's three-line format
(:download:`iris.tab <../../../../Orange/datasets/iris.tab>`).

.. literalinclude:: ../../../../Orange/datasets/iris.tab
   :lines: 1-7


Single-line header format
-------------------------

Single-line header consists of feature names prefixed by an optional "``<flags>#``"
string, i.e. flags followed by a hash ('#') sign. The flags can be a consistent
combination of:

* ``c`` for class feature (also known as a target variable or dependent variable),
* ``i`` for feature to be ignored,
* ``m`` for meta attributes (not used in learning),
* ``C`` for features that are continuous (numeric),
* ``D`` for features that are discrete (categorical),
* ``T`` for features that represent date and/or time in one of the ISO 8601
  formats,
* ``S`` for string features.

If some (all) names or flags are omitted, the names, types, and flags are
discerned automatically, and correctly (most of the time).

---

## File: doc/data-mining-library/source/reference/data.rst

.. currentmodule:: Orange.data

#####################
Data model (``data``)
#####################

Orange stores data in :obj:`Orange.data.Storage` classes. The most commonly used
storage is :obj:`Orange.data.Table`, which stores all data in two-dimensional
numpy arrays. Each row of the data represents a data instance.

Individual data instances are represented as instances of
:obj:`Orange.data.Instance`. Different storage classes may derive subclasses
of :obj:`~Orange.data.Instance` to represent the retrieved rows in the data
more efficiently and to allow modifying the data through modifying data
instance. For example, if `table` is :obj:`Orange.data.Table`, `table[0]`
returns the row as :obj:`Orange.data.RowInstance`.

Every storage class and data instance has an associated domain description
`domain` (an instance of :obj:`Orange.data.Domain`) that stores descriptions of
data columns. Every column is described by an instance of a class derived from
:obj:`Orange.data.Variable`. The subclasses correspond to continuous variables
(:obj:`Orange.data.ContinuousVariable`), discrete variables
(:obj:`Orange.data.DiscreteVariable`) and string variables
(:obj:`Orange.data.StringVariable`). These descriptors contain the
variable's name, symbolic values, number of decimals in printouts and similar.

The data is divided into attributes (features, independent variables), class
variables (classes, targets, outcomes, dependent variables) and meta
attributes. This division applies to domain descriptions, data storages that
contain separate arrays for each of the three parts of the data and data
instances.

Attributes and classes are represented with numeric values and are used in
modelling. Meta attributes contain additional data which may be of any type.
(Currently, only string values are supported in addition to continuous and
numeric.)

In indexing, columns can be referred to by their names,
descriptors or an integer index. For example, if `inst` is a data instance
and `var` is a descriptor of type :obj:`~Orange.data.Continuous`, referring to
the first column in the data, which is also names "petal length", then
`inst[var]`, `inst[0]` and `inst["petal length"]` refer to the first value
of the instance. Negative indices are used for meta attributes, starting with
-1.

Continuous and discrete values can be represented by any numerical type; by
default, Orange uses double precision (64-bit) floats. Discrete values are
represented by whole numbers.

.. toctree::
    :maxdepth: 2

    data.storage
    data.table
    data.sql
    data.domain
    data.variable
    data.value
    data.instance
    data.filters
    data.io
    data.pandas

.. index:: Data

---

## File: doc/data-mining-library/source/reference/data.sql.rst

.. currentmodule:: Orange.data.sql.table

########################
SQL table (``data.sql``)
########################

.. autoclass:: Orange.data.sql.table.SqlTable
    :members:
    :special-members:

    :obj:`SqlTable` represents a table with the data which is stored in the
    database. Besides the inherited attributes, the object stores a connection
    to the database and row filters.

    Constructor connects to the database, infers the variable types from the
    types of the columns in the database and constructs the corresponding
    domain description. Discrete and continuous variables are put among
    attributes, and string variables are meta attributes. The domain does not
    have a class.

    :obj:`SqlTable` overloads the data access methods for random access to
    rows and for iteration (`__getitem__` and `__iter__`). It also provides
    methods for fast computation of basic statistics, distributions and
    contingency matrices, as well as for filtering the data. Filtering the
    data returns a new instance of :obj:`SqlTable`. The new instances however
    differs only in that an additional filter is added to the row_filter.

    All evaluation is lazy in the sense that most operations just modify the
    domain and the list of filters. These are used to construct an SQL query
    when the data is actually needed, for instance to retrieve a data row or
    compute a distribution of values for a certain column.

    .. attribute:: connection

        The object that holds the database connection. An instance of a class
        compatible with Python DB API 2.0.

    .. attribute:: host

        The host name of the database server

    .. attribute:: database

        The name of the database

    .. attribute:: table_name

        The name of the table in the database

    .. attribute:: row_filters

        A list of filters that are applied when constructing the query. The
        filters in the should have a method `to_sql`. Module
        :obj:`Orange.data.sql.filter` contains classes derived from filters in
        :obj:`Orange.data.filter` with the appropriate implementation of the
        method.