TransWikia.com

How to get summary statistics in Orange?

Data Science Asked by John Tarr on April 28, 2021

I just started using Orange, and am having trouble finding how to get basic summary statistics, like the n (count), average, and standard deviation.

Is there a widget that does this and I’m simply overlooking it?

2 Answers

I found 3 ways to do it :

  • you have to use the Data Info widget who gives the number of rows of your dataset and the Box Plot widget who prints the average and the standard deviation of each feature in your dataset. Pro: easy to use. Con: you are unable to use this data.
  • you can create a Python script who will compute the average and the standard deviation using the statistics package. Pro: you can reuse your data. Con: you have to write a script and format the output data correctly.
  • it exists an add-on call "Orange3-Timeseries" with a Moving Transform widget who can compute the average and the standard deviation of your series. Pro: easy to use. Cons: the package is still a beta-version and have some bugs, the widget only works with timeseries.

Correct answer by Pierre on April 28, 2021

For those of us who want more examples of scripts with the Orange3 API on the web, here is a solution that worked for me.

from Orange.data import ContinuousVariable,DiscreteVariable
import numpy as np
dom = in_data.domain
continuous = [d for d in dom.variables if type(d) == ContinuousVariable]
rows = ["mean","std","min","max","range"]
dom = Domain(continuous,metas = [DiscreteVariable(name="stat",values=rows)])
summary = [
    [np.mean(in_data[:,dom.index(d)]) for d in continuous],
    [np.std(in_data[:,dom.index(d)]) for d in continuous],
    [np.min(in_data[:,dom.index(d)]) for d in continuous],
    [np.max(in_data[:,dom.index(d)]) for d in continuous],
    [np.ptp(in_data[:,dom.index(d)]) for d in continuous] ]
meta = [[i] for i in range(0,5)]
out_data = Table.from_numpy(dom,summary,metas=meta)

Answered by Collin Conway on April 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP