Skip to content

Instantly share code, notes, and snippets.

@blehman
Created March 28, 2024 19:46
Show Gist options
  • Save blehman/646f02bbb1343b09baf98c7ae1253ece to your computer and use it in GitHub Desktop.
Save blehman/646f02bbb1343b09baf98c7ae1253ece to your computer and use it in GitHub Desktop.
Coherence Scores (baseline interactive legend)
{
"config": {
"view": {"continuousWidth": 300, "continuousHeight": 300},
"axis": {"titleFont": "Courier", "titleFontSize": 15},
"axisBottom": {
"labelColor": "gray",
"titleColor": "gray",
"titleFont": "Courier"
},
"axisLeft": {
"labelColor": "black",
"titleColor": "black",
"titleFont": "Courier"
},
"axisRight": {
"labelColor": "#2ca02c",
"titleColor": "#2ca02c",
"titleFont": "Courier"
},
"legend": {
"labelFont": "Courier",
"labelFontSize": 15,
"labelOverlap": false,
"symbolSize": 400,
"symbolStrokeWidth": 5,
"title": null,
"titleFontSize": 15
},
"title": {
"anchor": "start",
"color": "gray",
"font": "Courier",
"fontSize": 30
}
},
"layer": [
{
"mark": {"type": "line"},
"encoding": {"color": {"field": "model_name", "type": "nominal"}},
"name": "view_3",
"transform": [{"fold": ["c_v", "u_mass"], "as": ["Measure", "Value"]}]
},
{
"mark": {"type": "line", "opacity": 0.9, "point": true},
"encoding": {
"color": {"field": "model_name", "type": "nominal"},
"opacity": {
"condition": {"param": "param_13", "value": 1},
"value": 0.2
},
"tooltip": [
{"field": "c_v", "type": "quantitative"},
{"field": "model_name", "type": "nominal"},
{"field": "num_topics", "type": "quantitative"}
],
"x": {"field": "num_topics", "type": "quantitative"},
"y": {"field": "c_v", "title": "c_v score", "type": "quantitative"}
},
"transform": [{"fold": ["c_v", "u_mass"], "as": ["Measure", "Value"]}]
},
{
"mark": {"type": "line", "opacity": 1, "point": true},
"encoding": {
"color": {"field": "model_name", "type": "nominal"},
"opacity": {
"condition": {"param": "param_13", "value": 1},
"value": 0.2
},
"tooltip": [
{"field": "u_mass", "type": "quantitative"},
{"field": "model_name", "type": "nominal"},
{"field": "num_topics", "type": "quantitative"}
],
"x": {"field": "num_topics", "type": "quantitative"},
"y": {
"field": "u_mass",
"title": "u_mass score",
"type": "quantitative"
}
},
"transform": [{"fold": ["c_v", "u_mass"], "as": ["Measure", "Value"]}]
},
{
"mark": {
"type": "circle",
"fillOpacity": 0,
"size": 70,
"stroke": "#2ca02c"
},
"encoding": {
"color": {"field": "model_name", "type": "nominal"},
"tooltip": [
{"field": "u_mass", "type": "quantitative"},
{"field": "model_name", "type": "nominal"},
{"field": "num_topics", "type": "quantitative"}
],
"x": {"field": "num_topics", "type": "quantitative"},
"y": {
"axis": {"labels": false},
"field": "u_mass",
"title": "",
"type": "quantitative"
}
},
"transform": [{"fold": ["c_v", "u_mass"], "as": ["Measure", "Value"]}]
},
{
"mark": {
"type": "circle",
"fillOpacity": 0,
"size": 70,
"stroke": "black"
},
"encoding": {
"color": {"field": "model_name", "type": "nominal"},
"tooltip": [
{"field": "c_v", "type": "quantitative"},
{"field": "model_name", "type": "nominal"},
{"field": "num_topics", "type": "quantitative"}
],
"x": {
"field": "num_topics",
"scale": {"domain": [2, 20.9]},
"type": "quantitative"
},
"y": {
"axis": {"labels": false},
"field": "c_v",
"title": "",
"type": "quantitative"
}
},
"transform": [{"fold": ["c_v", "u_mass"], "as": ["Measure", "Value"]}]
}
],
"data": {"name": "data-5ed19fc0806f47f774dbf5f24dc41b24"},
"height": 400,
"params": [
{
"name": "param_13",
"select": {"type": "point", "fields": ["model_name"]},
"bind": "legend",
"views": ["view_3"]
}
],
"resolve": {"scale": {"y": "independent"}},
"title": {"text": ["Topic Model(s) Coherence Scores"], "subtitle": [""]},
"width": 800,
"$schema": "https://vega.github.io/schema/vega-lite/v5.8.0.json",
"datasets": {
"data-5ed19fc0806f47f774dbf5f24dc41b24": [
{
"c_v": 0.3313858868693275,
"u_mass": -15.743772729430873,
"num_topics": 3,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.3313858868693275,
"u_mass": -15.743772729430873,
"num_topics": 3,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.31499705061969235,
"u_mass": -14.759531089932343,
"num_topics": 3,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.31499705061969235,
"u_mass": -14.72626632130961,
"num_topics": 3,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.4290502837399559,
"u_mass": -14.237781207744728,
"num_topics": 4,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.4290502837399559,
"u_mass": -14.239447962876868,
"num_topics": 4,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.3180848558875996,
"u_mass": -13.086216713907016,
"num_topics": 4,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.32573459981328906,
"u_mass": -13.16795784943859,
"num_topics": 4,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.28236284614998813,
"u_mass": -12.769529169731701,
"num_topics": 5,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.28236284614998813,
"u_mass": -12.769529169731701,
"num_topics": 5,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.3184530134549975,
"u_mass": -10.349949694272937,
"num_topics": 5,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.3052518045008154,
"u_mass": -10.23576784104363,
"num_topics": 5,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.3486512301445823,
"u_mass": -10.516965936008958,
"num_topics": 6,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.2794813760120775,
"u_mass": -11.849554949660225,
"num_topics": 6,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.38443123449903016,
"u_mass": -10.645888363130561,
"num_topics": 6,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.3831423298202148,
"u_mass": -10.444572234830176,
"num_topics": 6,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.40495410839545354,
"u_mass": -10.892970399849672,
"num_topics": 7,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.40495410839545354,
"u_mass": -10.89296555512868,
"num_topics": 7,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.3932590810808859,
"u_mass": -10.992319050133377,
"num_topics": 7,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.39275418605457174,
"u_mass": -10.966134341161546,
"num_topics": 7,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.3614782901774053,
"u_mass": -10.614950179451586,
"num_topics": 8,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.3614782901774053,
"u_mass": -10.61297579449371,
"num_topics": 8,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.3765282953527644,
"u_mass": -10.97955007785028,
"num_topics": 8,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.381967137683177,
"u_mass": -10.783802298760884,
"num_topics": 8,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.3526804489959946,
"u_mass": -9.693707549421193,
"num_topics": 9,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.35427158108487455,
"u_mass": -9.571984902266836,
"num_topics": 9,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.4385702812942837,
"u_mass": -9.420515035834846,
"num_topics": 9,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.4439532208641127,
"u_mass": -9.328938035061189,
"num_topics": 9,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.3656934172113673,
"u_mass": -9.344317736628657,
"num_topics": 10,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.36550055202809006,
"u_mass": -9.339816152408758,
"num_topics": 10,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.4386487221304599,
"u_mass": -8.596113729621681,
"num_topics": 10,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.4376289532725616,
"u_mass": -8.590293326724703,
"num_topics": 10,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.34780857829566364,
"u_mass": -9.785784154407928,
"num_topics": 11,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.3479921028798954,
"u_mass": -9.793008693151949,
"num_topics": 11,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.44452276067888746,
"u_mass": -9.499651150829996,
"num_topics": 11,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.44261714398157187,
"u_mass": -9.495062422041947,
"num_topics": 11,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.3663956685900092,
"u_mass": -9.102568304357959,
"num_topics": 12,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.37665002373592693,
"u_mass": -9.24175745067685,
"num_topics": 12,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.44184665306512233,
"u_mass": -9.416178069950293,
"num_topics": 12,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.4427348574778822,
"u_mass": -9.518891333080983,
"num_topics": 12,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.387099325759979,
"u_mass": -8.689494725662131,
"num_topics": 13,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.38739622697178766,
"u_mass": -8.6807361095616,
"num_topics": 13,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.43684682600812813,
"u_mass": -10.282132065396333,
"num_topics": 13,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.43781909595097984,
"u_mass": -10.292743356000715,
"num_topics": 13,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.3862255656202223,
"u_mass": -9.203943790123729,
"num_topics": 14,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.38675261087090623,
"u_mass": -9.165040842806464,
"num_topics": 14,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.45481647682706006,
"u_mass": -9.246112918119264,
"num_topics": 14,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.45417133033561863,
"u_mass": -9.246960743062944,
"num_topics": 14,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.41467691000286866,
"u_mass": -8.883043533510007,
"num_topics": 15,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.41467691000286855,
"u_mass": -8.883486564671704,
"num_topics": 15,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.44736913799257766,
"u_mass": -10.642405671451508,
"num_topics": 15,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.44749543796309943,
"u_mass": -10.569365170122463,
"num_topics": 15,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.4067373442831749,
"u_mass": -8.446247795932695,
"num_topics": 16,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.4000503151936343,
"u_mass": -8.703950009427965,
"num_topics": 16,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.44787994853989466,
"u_mass": -9.960035546103637,
"num_topics": 16,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.4475468001065708,
"u_mass": -9.960549842786438,
"num_topics": 16,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.3993806218020021,
"u_mass": -9.121405339914045,
"num_topics": 17,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.3999163992519709,
"u_mass": -9.17094496660384,
"num_topics": 17,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.46160209966882215,
"u_mass": -11.394354795410104,
"num_topics": 17,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.46235372345763986,
"u_mass": -11.405710356220414,
"num_topics": 17,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.40575381175686653,
"u_mass": -9.792766838345798,
"num_topics": 18,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.4071815838121874,
"u_mass": -9.802409492867119,
"num_topics": 18,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.4161615770561806,
"u_mass": -11.849995370167749,
"num_topics": 18,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.41741578136666263,
"u_mass": -11.787557070777229,
"num_topics": 18,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.3832051901309756,
"u_mass": -9.01661744722125,
"num_topics": 19,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.3827610225352175,
"u_mass": -9.00779015490769,
"num_topics": 19,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.44704168617233586,
"u_mass": -11.391846538520928,
"num_topics": 19,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.4368215794672795,
"u_mass": -11.478840397137002,
"num_topics": 19,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
},
{
"c_v": 0.3761997398580298,
"u_mass": -10.363064463689886,
"num_topics": 20,
"alpha": "auto",
"method": "m1",
"model_name": "m1auto"
},
{
"c_v": 0.3754872359879073,
"u_mass": -10.353020989791215,
"num_topics": 20,
"alpha": "symmetric",
"method": "m1",
"model_name": "m1symmetric"
},
{
"c_v": 0.42852036827005835,
"u_mass": -10.512067590158706,
"num_topics": 20,
"alpha": "auto",
"method": "m2",
"model_name": "m2auto"
},
{
"c_v": 0.42682633109961066,
"u_mass": -10.523431479242472,
"num_topics": 20,
"alpha": "symmetric",
"method": "m2",
"model_name": "m2symmetric"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment