File size: 814 Bytes
a11111b
 
 
da30ddb
167545b
a11111b
167545b
a11111b
 
 
 
 
 
 
 
 
 
 
 
 
 
167545b
a11111b
 
e96be06
2447927
a11111b
 
 
1330a50
44895b4
e96be06
2447927
a11111b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from sklearn.preprocessing import RobustScaler
import seaborn as sns
import umap
import thisnotthat as tnt
import panel as pn
pn.extension('tabulator')

penguins = (
    sns.load_dataset('penguins')
    .dropna()
    .rename(
        columns={
            "bill_length_mm": "bill-length",
            "bill_depth_mm": "bill-depth",
            "flipper_length_mm": "flipper-length",
            "body_mass_g": "body-mass"
        }
    )
)

data_for_umap = RobustScaler().fit_transform(penguins.select_dtypes(include="number"))

penguin_datamap = umap.UMAP(random_state=42).fit_transform(data_for_umap)


basic_plot = tnt.BokehPlotPane(
    penguin_datamap,
    labels=penguins.species,
    hover_text=penguins.select_dtypes(include="object").apply(" ".join, axis=1),
    width=800
)

pn.Row(basic_plot).servable