import{$ as e,S as t,St as n,V as r,_ as i,b as a,g as o,m as s,ut as c,v as l,vt as u,w as d,y as f,yt as p,z as m}from"./modules/shiki-CkJq9tSf.js";import{t as h}from"./_plugin-vue_export-helper-BDNMzG2s.js";import{n as g}from"./slidev/context-DnYiQGy6.js";import{D as _,O as v,d as y,f as b,s as x,x as S,y as C}from"./useGenerative-DDHg2gzY.js";import{t as w}from"./Plot2D-C9URVmMB.js";import{t as T}from"./PlotLabel-BilrlAqg.js";import{t as E}from"./PlotPoints-CeOGnq0p.js";import{t as D}from"./PlotCurve-CJaWe74-.js";var O={class:`dl-ae`},ee={class:`dl-ae__strip`,viewBox:`0 0 470 46`,role:`img`,"aria-label":`The latent codes of every training point, on one axis`},k=[`x1`,`x2`],A=[`x1`,`x2`],j=[`x1`,`x2`],M=[`x`],N={key:0},P={key:1},F={key:2},I={key:3},L=420,R=26,z=h(d({__name:`AutoencoderLab`,props:{latentDim:{default:1}},setup(d){let{$slidev:h,$nav:z,$clicksContext:te,$clicks:ne,$page:re,$renderContext:ie,$frontmatter:ae}=g(),B=c(d.latentDim),V=S(22),H=y(V),U=o(()=>B.value===2?V:V.map(C)),W=o(()=>{let e=[];for(let t=0;t<=80;t++)e.push(x(-1.25+2.5*t/80));return e}),G=[-1,0,...b(H)],K=c(-1),q=o(()=>K.value>=0?G[K.value%G.length]:null),J=o(()=>q.value===null?null:x(q.value)),Y=o(()=>{let e=J.value;return e?Math.sqrt(Math.min(...V.map(t=>(t.x-e.x)**2+(t.y-e.y)**2))):null}),X=o(()=>Y.value!==null&&Y.value>.6);function Z(){K.value+=1}function Q(){K.value=-1}function $(e){return R+(e+1.5)/3*L}return(o,c)=>{let d=D,h=E,g=T,y=w,b=_,x=v;return m(),l(x,{"max-width":`44rem`},{controls:e(()=>[t(b,{label:B.value===1?`latent = 1 (undercomplete)`:`latent = 2 (as wide as the input)`,variant:`ghost`,glyph:`⇆`,onClick:c[0]||=e=>B.value=B.value===1?2:1},null,8,[`label`]),t(b,{label:`Decode a fresh z`,disabled:B.value!==1,onClick:Z},null,8,[`disabled`]),K.value>=0?(m(),l(b,{key:0,label:`Clear`,variant:`ghost`,onClick:Q})):f(`v-if`,!0)]),readout:e(()=>[B.value===2?(m(),a(`span`,N,` Latent as wide as the input: the reconstruction is exact and the model has learned nothing — grey and teal are the same points. `)):q.value===null?(m(),a(`span`,P,` Latent codes sit in three clumps with two gaps. Decode a z from a gap and see what comes out. `)):X.value?(m(),a(`span`,F,` z = `+n(q.value.toFixed(2))+` fell in a gap. The nearest real example is `+n(Y.value.toFixed(2))+` away — this output is not data. `,1)):(m(),a(`span`,I,` z = `+n(q.value.toFixed(2))+` sits inside a clump, so it decodes to something plausible — nearest real example `+n(Y.value.toFixed(2))+` away. `,1))]),default:e(()=>[i(`div`,O,[t(y,{"x-domain":[-3.6,3.6],"y-domain":[-2.4,2.4],width:470,height:220,"x-ticks":[-3,0,3],"y-ticks":[-2,0,2]},{default:e(()=>[f(` everything a 1-D decoder can produce, ever `),B.value===1?(m(),l(d,{key:0,points:W.value,color:`var(--dl-accent)`,width:2,opacity:.5},null,8,[`points`])):f(`v-if`,!0),t(h,{points:u(V),radius:3.4,color:`var(--dl-muted)`,opacity:.55},null,8,[`points`]),t(h,{points:U.value,radius:3,color:`var(--dl-accent)`},null,8,[`points`]),J.value?(m(),a(s,{key:1},[t(h,{points:[{...J.value,highlight:!0}],radius:7,color:X.value?`var(--dl-danger)`:`var(--dl-heading)`},null,8,[`points`,`color`]),t(g,{at:[J.value.x,J.value.y],text:`g(${q.value.toFixed(2)})`,dy:-14,color:X.value?`var(--dl-danger)`:`var(--dl-heading)`,bold:``},null,8,[`at`,`text`,`color`])],64)):f(`v-if`,!0)]),_:1}),f(` where the training data's codes actually are `),(m(),a(`svg`,ee,[i(`line`,{class:`dl-ae__axis`,x1:$(-1.5),x2:$(1.5),y1:`26`,y2:`26`},null,8,k),(m(!0),a(s,null,r(u(H),(e,t)=>(m(),a(`line`,{key:t,class:`dl-ae__tick`,x1:$(e),x2:$(e),y1:`16`,y2:`26`},null,8,A))),128)),q.value===null?f(`v-if`,!0):(m(),a(s,{key:0},[i(`line`,{class:p([`dl-ae__probe`,{"is-hole":X.value}]),x1:$(q.value),x2:$(q.value),y1:`10`,y2:`34`},null,10,j),i(`text`,{class:p([`dl-ae__probelab`,{"is-hole":X.value}]),x:$(q.value),y:`44`,"text-anchor":`middle`},`z = `+n(q.value.toFixed(2)),11,M)],64)),c[1]||=i(`text`,{class:`dl-ae__striplab`,x:`8`,y:`30`},`z`,-1)]))])]),_:1})}}}),[[`__scopeId`,`data-v-f2ff8b85`]]);export{z as t};