OpenBI Docs Buy

UMAP OpenBI

A map of the rows in two dimensions, near rows near each other (UMAP).

Group: Many variables at once. OpenBI’s own: DAX has no function of this name.

Syntax

UMAP ( <table>, <key> [, <settings>], <name>, <expression> [, <name>, <expression>] … )
ParameterTypeDescription
tableTableThe rows to map.
keyExpression
evaluated for each row
What names each row in the result.
settingsText
optional
Settings as name=value, commas between. dims, the map's dimensions: 2 by default. neighbors, 15 by default; min_dist, 0.1; spread, 1. epochs, the rounds of layout: when 0, the default, 500 up to 10,000 rows and 200 above. seed, for another random start.
nameText
repeatable
A variable's name, a text in quotes; one or more variables.
expressionExpression
repeatable, evaluated for each row
That variable's number for each row.

Returns

Table. A row for each row of the table that has every variable: Key, then D1, D2 (and more with dims) with the row's place on the map.

Remarks

  • UMAP (uniform manifold approximation and projection) lays the rows out so that rows alike in their variables lie near each other. Distances between groups far apart mean little, and the axes have no units.
  • neighbors is how many nearest rows each row looks to: few for fine detail, more for the overall shape. min_dist is how closely rows may pack together.
  • The same rows and settings always give the same map; another seed gives a different map with the same neighbourhoods.
  • The settings are read as such only when they come right after the key and hold an =; an unknown setting is an error.
  • Every variable is first put on one scale: how many standard deviations each row lies above or below that variable's mean. Liters and kroner then weigh alike, and a change of units changes nothing.
  • A row where any variable is blank is left out. A variable must be a number on every row (text is an error, even text that reads as a number), and one that is the same on every row is an error too.
  • The map needs more rows than dimensions plus one.

Compared with DAX

An OpenBI function: DAX has none like it, so a measure or query that uses it works in OpenBI only, not in Power BI or Analysis Services.

Examples

Two groups of shops, apart

With three neighbours each, the small shops and the big shops form two tight groups, well apart.

EVALUATE
VAR Shops =
    DATATABLE (
        "Shop", STRING, "Liters", INTEGER, "Visits", INTEGER,
        {
            { "A", 100, 10 }, { "B", 110, 12 }, { "C", 95, 9 },
            { "D", 400, 30 }, { "E", 420, 33 }, { "F", 390, 28 }
        }
    )
RETURN
    UMAP ( Shops, [Shop], "neighbors=3", "Liters", [Liters], "Visits", [Visits] )
KeyD1D2
A-12.763458502113112.6956140530186
B-12.4574935438813.2634797027964
C-13.167508071637513.1886895652525
D-5.6628731653092811.5737150137555
E-5.0072569609820211.3312930763718
F-5.5857308844197710.7896180072213

Places by location and crates

EVALUATE
UMAP (
    Places,
    Places[District],
    "Lat", Places[Lat],
    "Lon", Places[Lon],
    "Crates", Places[Crates]
)
KeyD1D2
Alnabru2.339179552295390.292877470911355
Grünerløkka2.271049029055852.68078884946325
Majorstuen1.724966474714862.18943938062332
Frogner2.256209474443691.73121664379741
Bjørvika3.06308763383082.13170265385851
Nydalen0.3335770270339871.83152422124987
Storo0.8642622442043341.15849708111757
Tøyen2.887163966046391.18536314462576
Sagene0.7042882678437992.54348860393536
St. Hanshaugen1.486943760906492.86360299863653
Grønland3.408677393887791.57802498907059
Skøyen1.660583405579071.29356134382422
Ullevål0.3603904379412561.33806883297923
Torshov1.087340749631262.08533908019682
Kampen2.934515156655790.485688838898826
Vålerenga3.570965821965810.77391645314724

PCA.SCORES, KMEANS, PCA.COMPONENTS.

Last updated · OpenBI Studio 0.3.74