import{S as ta,i as aa,s as oa,e as o,k as s,w as g,t as i,M as na,c as n,d as a,m as l,a as r,x as _,h as d,b as c,G as e,g as h,y as b,L as ra,q as E,o as $,B as y,v as sa}from"../../chunks/vendor-hf-doc-builder.js";import{D as F}from"../../chunks/Docstring-hf-doc-builder.js";import{I as Pt}from"../../chunks/IconCopyLink-hf-doc-builder.js";function ia(At){let x,$e,k,P,te,U,Ve,ae,Fe,ye,N,A,oe,J,Ue,ne,Je,we,u,R,Re,re,qe,He,X,se,We,ze,Be,ie,Ge,Ke,O,q,je,H,Qe,le,Xe,Ye,Ze,C,W,et,I,tt,de,at,ot,ce,nt,rt,Me,D,S,ue,z,st,pe,it,xe,w,lt,me,dt,ct,ve,ut,pt,ke,p,B,mt,fe,vt,ft,L,G,ht,he,gt,_t,T,K,bt,ge,Et,$t,M,j,yt,_e,wt,Mt,be,xt,kt,V,Q,Nt,Ee,It,Ne;return U=new Pt({}),J=new Pt({}),R=new F({props:{name:"class evaluate.EvaluationModuleInfo",anchor:"evaluate.EvaluationModuleInfo",parameters:[{name:"description",val:": str"},{name:"citation",val:": str"},{name:"features",val:": typing.Union[datasets.features.features.Features, typing.List[datasets.features.features.Features]]"},{name:"inputs_description",val:": str = <factory>"},{name:"homepage",val:": str = <factory>"},{name:"license",val:": str = <factory>"},{name:"codebase_urls",val:": typing.List[str] = <factory>"},{name:"reference_urls",val:": typing.List[str] = <factory>"},{name:"streamable",val:": bool = False"},{name:"format",val:": typing.Optional[str] = None"},{name:"module_type",val:": str = 'metric'"},{name:"metric_name",val:": typing.Optional[str] = None"},{name:"config_name",val:": typing.Optional[str] = None"},{name:"experiment_id",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/evaluate/blob/vr_146/src/evaluate/info.py#L35"}}),q=new F({props:{name:"from_directory",anchor:"evaluate.EvaluationModuleInfo.from_directory",parameters:[{name:"metric_info_dir",val:""}],source:"https://github.com/huggingface/evaluate/blob/vr_146/src/evaluate/info.py#L81"}}),W=new F({props:{name:"write_to_directory",anchor:"evaluate.EvaluationModuleInfo.write_to_directory",parameters:[{name:"metric_info_dir",val:""}],source:"https://github.com/huggingface/evaluate/blob/vr_146/src/evaluate/info.py#L71"}}),z=new Pt({}),B=new F({props:{name:"class evaluate.EvaluationModule",anchor:"evaluate.EvaluationModule",parameters:[{name:"config_name",val:": typing.Optional[str] = None"},{name:"keep_in_memory",val:": bool = False"},{name:"cache_dir",val:": typing.Optional[str] = None"},{name:"num_process",val:": int = 1"},{name:"process_id",val:": int = 0"},{name:"seed",val:": typing.Optional[int] = None"},{name:"experiment_id",val:": typing.Optional[str] = None"},{name:"max_concurrent_cache_files",val:": int = 10000"},{name:"timeout",val:": typing.Union[int, float] = 100"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"evaluate.EvaluationModule.config_name",description:`<strong>config_name</strong> (<code>str</code>) &#x2014; This is used to define a hash specific to a module computation script and prevents the module&#x2019;s data
to be overridden when the module loading script is modified.`,name:"config_name"},{anchor:"evaluate.EvaluationModule.keep_in_memory",description:"<strong>keep_in_memory</strong> (<code>bool</code>) &#x2014; keep all predictions and references in memory. Not possible in distributed settings.",name:"keep_in_memory"},{anchor:"evaluate.EvaluationModule.cache_dir",description:`<strong>cache_dir</strong> (<code>str</code>) &#x2014; Path to a directory in which temporary prediction/references data will be stored.
The data directory should be located on a shared file-system in distributed setups.`,name:"cache_dir"},{anchor:"evaluate.EvaluationModule.num_process",description:`<strong>num_process</strong> (<code>int</code>) &#x2014; specify the total number of nodes in a distributed settings.
This is useful to compute module in distributed setups (in particular non-additive modules like F1).`,name:"num_process"},{anchor:"evaluate.EvaluationModule.process_id",description:`<strong>process_id</strong> (<code>int</code>) &#x2014; specify the id of the current process in a distributed setup (between 0 and num_process-1)
This is useful to compute module in distributed setups (in particular non-additive metrics like F1).`,name:"process_id"},{anchor:"evaluate.EvaluationModule.seed",description:'<strong>seed</strong> (<code>int</code>, optional) &#x2014; If specified, this will temporarily set numpy&#x2019;s random seed when <a href="/docs/evaluate/pr_146/en/package_reference/main_classes#evaluate.EvaluationModule.compute">evaluate.EvaluationModule.compute()</a> is run.',name:"seed"},{anchor:"evaluate.EvaluationModule.experiment_id",description:`<strong>experiment_id</strong> (<code>str</code>) &#x2014; A specific experiment id. This is used if several distributed evaluations share the same file system.
This is useful to compute module in distributed setups (in particular non-additive metrics like F1).`,name:"experiment_id"},{anchor:"evaluate.EvaluationModule.max_concurrent_cache_files",description:"<strong>max_concurrent_cache_files</strong> (<code>int</code>) &#x2014; Max number of concurrent module cache files (default 10000).",name:"max_concurrent_cache_files"},{anchor:"evaluate.EvaluationModule.timeout",description:"<strong>timeout</strong> (<code>Union[int, float]</code>) &#x2014; Timeout in second for distributed setting synchronization.",name:"timeout"}],source:"https://github.com/huggingface/evaluate/blob/vr_146/src/evaluate/module.py#L143"}}),G=new F({props:{name:"add",anchor:"evaluate.EvaluationModule.add",parameters:[{name:"prediction",val:" = None"},{name:"reference",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"evaluate.EvaluationModule.add.prediction",description:"<strong>prediction</strong> (list/array/tensor, optional) &#x2014; Predictions.",name:"prediction"},{anchor:"evaluate.EvaluationModule.add.reference",description:"<strong>reference</strong> (list/array/tensor, optional) &#x2014; References.",name:"reference"}],source:"https://github.com/huggingface/evaluate/blob/vr_146/src/evaluate/module.py#L505"}}),K=new F({props:{name:"add_batch",anchor:"evaluate.EvaluationModule.add_batch",parameters:[{name:"predictions",val:" = None"},{name:"references",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"evaluate.EvaluationModule.add_batch.predictions",description:"<strong>predictions</strong> (list/array/tensor, optional) &#x2014; Predictions.",name:"predictions"},{anchor:"evaluate.EvaluationModule.add_batch.references",description:"<strong>references</strong> (list/array/tensor, optional) &#x2014; References.",name:"references"}],source:"https://github.com/huggingface/evaluate/blob/vr_146/src/evaluate/module.py#L458"}}),j=new F({props:{name:"compute",anchor:"evaluate.EvaluationModule.compute",parameters:[{name:"predictions",val:" = None"},{name:"references",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"evaluate.EvaluationModule.compute.predictions",description:"<strong>predictions</strong> (list/array/tensor, optional) &#x2014; Predictions.",name:"predictions"},{anchor:"evaluate.EvaluationModule.compute.references",description:"<strong>references</strong> (list/array/tensor, optional) &#x2014; References.",name:"references"},{anchor:"evaluate.EvaluationModule.compute.*kwargs",description:`*<strong>*kwargs</strong> (optional) &#x2014; Keyword arguments that will be forwarded to the evaluation module <code>_compute</code>
method (see details in the docstring).`,name:"*kwargs"}],source:"https://github.com/huggingface/evaluate/blob/vr_146/src/evaluate/module.py#L394",returnDescription:`
<p>dict or None</p>
<ul>
<li>Dictionary with the results if this evaluation module is run on the main process (<code>process_id == 0</code>).</li>
<li>None if the evaluation module is not run on the main process (<code>process_id != 0</code>).</li>
</ul>
`}}),Q=new F({props:{name:"download_and_prepare",anchor:"evaluate.EvaluationModule.download_and_prepare",parameters:[{name:"download_config",val:": typing.Optional[evaluate.utils.file_utils.DownloadConfig] = None"},{name:"dl_manager",val:": typing.Optional[datasets.download.download_manager.DownloadManager] = None"}],parametersDescription:[{anchor:"evaluate.EvaluationModule.download_and_prepare.download_config",description:"<strong>download_config</strong> (<code>DownloadConfig</code>, optional) &#x2014; Specific download configuration parameters.",name:"download_config"},{anchor:"evaluate.EvaluationModule.download_and_prepare.dl_manager",description:"<strong>dl_manager</strong> (<code>DownloadManager</code>, optional) &#x2014; Specific download manager to use.",name:"dl_manager"}],source:"https://github.com/huggingface/evaluate/blob/vr_146/src/evaluate/module.py#L622"}}),{c(){x=o("meta"),$e=s(),k=o("h1"),P=o("a"),te=o("span"),g(U.$$.fragment),Ve=s(),ae=o("span"),Fe=i("Main classes"),ye=s(),N=o("h2"),A=o("a"),oe=o("span"),g(J.$$.fragment),Ue=s(),ne=o("span"),Je=i("EvaluationModuleInfo"),we=s(),u=o("div"),g(R.$$.fragment),Re=s(),re=o("p"),qe=i("Information about a metric."),He=s(),X=o("p"),se=o("code"),We=i("EvaluationModuleInfo"),ze=i(` documents a metric, including its name, version, and features.
See the constructor arguments and properties for a full list.`),Be=s(),ie=o("p"),Ge=i("Note: Not all fields are known on construction and may be updated later."),Ke=s(),O=o("div"),g(q.$$.fragment),je=s(),H=o("p"),Qe=i("Create EvaluationModuleInfo from the JSON file in "),le=o("code"),Xe=i("metric_info_dir"),Ye=i("."),Ze=s(),C=o("div"),g(W.$$.fragment),et=s(),I=o("p"),tt=i("Write "),de=o("code"),at=i("EvaluationModuleInfo"),ot=i(" as JSON to "),ce=o("code"),nt=i("metric_info_dir"),rt=i(`.
Also save the license separately in LICENCE.`),Me=s(),D=o("h2"),S=o("a"),ue=o("span"),g(z.$$.fragment),st=s(),pe=o("span"),it=i("EvaluationModule"),xe=s(),w=o("p"),lt=i("The base class "),me=o("code"),dt=i("Metric"),ct=i(" implements a Metric backed by one or several "),ve=o("code"),ut=i("Dataset"),pt=i("."),ke=s(),p=o("div"),g(B.$$.fragment),mt=s(),fe=o("p"),vt=i("A EvaluationModule is the base class and common API for metrics, comparisons, and measurements."),ft=s(),L=o("div"),g(G.$$.fragment),ht=s(),he=o("p"),gt=i("Add one prediction and reference for the evaluation module\u2019s stack."),_t=s(),T=o("div"),g(K.$$.fragment),bt=s(),ge=o("p"),Et=i("Add a batch of predictions and references for the evaluation module\u2019s stack."),$t=s(),M=o("div"),g(j.$$.fragment),yt=s(),_e=o("p"),wt=i("Compute the evaluation module."),Mt=s(),be=o("p"),xt=i("Usage of positional arguments is not allowed to prevent mistakes."),kt=s(),V=o("div"),g(Q.$$.fragment),Nt=s(),Ee=o("p"),It=i("Downloads and prepares dataset for reading."),this.h()},l(t){const m=na('[data-svelte="svelte-1phssyn"]',document.head);x=n(m,"META",{name:!0,content:!0}),m.forEach(a),$e=l(t),k=n(t,"H1",{class:!0});var Ie=r(k);P=n(Ie,"A",{id:!0,class:!0,href:!0});var Ot=r(P);te=n(Ot,"SPAN",{});var Ct=r(te);_(U.$$.fragment,Ct),Ct.forEach(a),Ot.forEach(a),Ve=l(Ie),ae=n(Ie,"SPAN",{});var St=r(ae);Fe=d(St,"Main classes"),St.forEach(a),Ie.forEach(a),ye=l(t),N=n(t,"H2",{class:!0});var De=r(N);A=n(De,"A",{id:!0,class:!0,href:!0});var Lt=r(A);oe=n(Lt,"SPAN",{});var Tt=r(oe);_(J.$$.fragment,Tt),Tt.forEach(a),Lt.forEach(a),Ue=l(De),ne=n(De,"SPAN",{});var Vt=r(ne);Je=d(Vt,"EvaluationModuleInfo"),Vt.forEach(a),De.forEach(a),we=l(t),u=n(t,"DIV",{class:!0});var v=r(u);_(R.$$.fragment,v),Re=l(v),re=n(v,"P",{});var Ft=r(re);qe=d(Ft,"Information about a metric."),Ft.forEach(a),He=l(v),X=n(v,"P",{});var Dt=r(X);se=n(Dt,"CODE",{});var Ut=r(se);We=d(Ut,"EvaluationModuleInfo"),Ut.forEach(a),ze=d(Dt,` documents a metric, including its name, version, and features.
See the constructor arguments and properties for a full list.`),Dt.forEach(a),Be=l(v),ie=n(v,"P",{});var Jt=r(ie);Ge=d(Jt,"Note: Not all fields are known on construction and may be updated later."),Jt.forEach(a),Ke=l(v),O=n(v,"DIV",{class:!0});var Pe=r(O);_(q.$$.fragment,Pe),je=l(Pe),H=n(Pe,"P",{});var Ae=r(H);Qe=d(Ae,"Create EvaluationModuleInfo from the JSON file in "),le=n(Ae,"CODE",{});var Rt=r(le);Xe=d(Rt,"metric_info_dir"),Rt.forEach(a),Ye=d(Ae,"."),Ae.forEach(a),Pe.forEach(a),Ze=l(v),C=n(v,"DIV",{class:!0});var Oe=r(C);_(W.$$.fragment,Oe),et=l(Oe),I=n(Oe,"P",{});var Y=r(I);tt=d(Y,"Write "),de=n(Y,"CODE",{});var qt=r(de);at=d(qt,"EvaluationModuleInfo"),qt.forEach(a),ot=d(Y," as JSON to "),ce=n(Y,"CODE",{});var Ht=r(ce);nt=d(Ht,"metric_info_dir"),Ht.forEach(a),rt=d(Y,`.
Also save the license separately in LICENCE.`),Y.forEach(a),Oe.forEach(a),v.forEach(a),Me=l(t),D=n(t,"H2",{class:!0});var Ce=r(D);S=n(Ce,"A",{id:!0,class:!0,href:!0});var Wt=r(S);ue=n(Wt,"SPAN",{});var zt=r(ue);_(z.$$.fragment,zt),zt.forEach(a),Wt.forEach(a),st=l(Ce),pe=n(Ce,"SPAN",{});var Bt=r(pe);it=d(Bt,"EvaluationModule"),Bt.forEach(a),Ce.forEach(a),xe=l(t),w=n(t,"P",{});var Z=r(w);lt=d(Z,"The base class "),me=n(Z,"CODE",{});var Gt=r(me);dt=d(Gt,"Metric"),Gt.forEach(a),ct=d(Z," implements a Metric backed by one or several "),ve=n(Z,"CODE",{});var Kt=r(ve);ut=d(Kt,"Dataset"),Kt.forEach(a),pt=d(Z,"."),Z.forEach(a),ke=l(t),p=n(t,"DIV",{class:!0});var f=r(p);_(B.$$.fragment,f),mt=l(f),fe=n(f,"P",{});var jt=r(fe);vt=d(jt,"A EvaluationModule is the base class and common API for metrics, comparisons, and measurements."),jt.forEach(a),ft=l(f),L=n(f,"DIV",{class:!0});var Se=r(L);_(G.$$.fragment,Se),ht=l(Se),he=n(Se,"P",{});var Qt=r(he);gt=d(Qt,"Add one prediction and reference for the evaluation module\u2019s stack."),Qt.forEach(a),Se.forEach(a),_t=l(f),T=n(f,"DIV",{class:!0});var Le=r(T);_(K.$$.fragment,Le),bt=l(Le),ge=n(Le,"P",{});var Xt=r(ge);Et=d(Xt,"Add a batch of predictions and references for the evaluation module\u2019s stack."),Xt.forEach(a),Le.forEach(a),$t=l(f),M=n(f,"DIV",{class:!0});var ee=r(M);_(j.$$.fragment,ee),yt=l(ee),_e=n(ee,"P",{});var Yt=r(_e);wt=d(Yt,"Compute the evaluation module."),Yt.forEach(a),Mt=l(ee),be=n(ee,"P",{});var Zt=r(be);xt=d(Zt,"Usage of positional arguments is not allowed to prevent mistakes."),Zt.forEach(a),ee.forEach(a),kt=l(f),V=n(f,"DIV",{class:!0});var Te=r(V);_(Q.$$.fragment,Te),Nt=l(Te),Ee=n(Te,"P",{});var ea=r(Ee);It=d(ea,"Downloads and prepares dataset for reading."),ea.forEach(a),Te.forEach(a),f.forEach(a),this.h()},h(){c(x,"name","hf:doc:metadata"),c(x,"content",JSON.stringify(la)),c(P,"id","main-classes"),c(P,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(P,"href","#main-classes"),c(k,"class","relative group"),c(A,"id","evaluate.EvaluationModuleInfo"),c(A,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(A,"href","#evaluate.EvaluationModuleInfo"),c(N,"class","relative group"),c(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(u,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(S,"id","evaluate.EvaluationModule"),c(S,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(S,"href","#evaluate.EvaluationModule"),c(D,"class","relative group"),c(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(M,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(p,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,m){e(document.head,x),h(t,$e,m),h(t,k,m),e(k,P),e(P,te),b(U,te,null),e(k,Ve),e(k,ae),e(ae,Fe),h(t,ye,m),h(t,N,m),e(N,A),e(A,oe),b(J,oe,null),e(N,Ue),e(N,ne),e(ne,Je),h(t,we,m),h(t,u,m),b(R,u,null),e(u,Re),e(u,re),e(re,qe),e(u,He),e(u,X),e(X,se),e(se,We),e(X,ze),e(u,Be),e(u,ie),e(ie,Ge),e(u,Ke),e(u,O),b(q,O,null),e(O,je),e(O,H),e(H,Qe),e(H,le),e(le,Xe),e(H,Ye),e(u,Ze),e(u,C),b(W,C,null),e(C,et),e(C,I),e(I,tt),e(I,de),e(de,at),e(I,ot),e(I,ce),e(ce,nt),e(I,rt),h(t,Me,m),h(t,D,m),e(D,S),e(S,ue),b(z,ue,null),e(D,st),e(D,pe),e(pe,it),h(t,xe,m),h(t,w,m),e(w,lt),e(w,me),e(me,dt),e(w,ct),e(w,ve),e(ve,ut),e(w,pt),h(t,ke,m),h(t,p,m),b(B,p,null),e(p,mt),e(p,fe),e(fe,vt),e(p,ft),e(p,L),b(G,L,null),e(L,ht),e(L,he),e(he,gt),e(p,_t),e(p,T),b(K,T,null),e(T,bt),e(T,ge),e(ge,Et),e(p,$t),e(p,M),b(j,M,null),e(M,yt),e(M,_e),e(_e,wt),e(M,Mt),e(M,be),e(be,xt),e(p,kt),e(p,V),b(Q,V,null),e(V,Nt),e(V,Ee),e(Ee,It),Ne=!0},p:ra,i(t){Ne||(E(U.$$.fragment,t),E(J.$$.fragment,t),E(R.$$.fragment,t),E(q.$$.fragment,t),E(W.$$.fragment,t),E(z.$$.fragment,t),E(B.$$.fragment,t),E(G.$$.fragment,t),E(K.$$.fragment,t),E(j.$$.fragment,t),E(Q.$$.fragment,t),Ne=!0)},o(t){$(U.$$.fragment,t),$(J.$$.fragment,t),$(R.$$.fragment,t),$(q.$$.fragment,t),$(W.$$.fragment,t),$(z.$$.fragment,t),$(B.$$.fragment,t),$(G.$$.fragment,t),$(K.$$.fragment,t),$(j.$$.fragment,t),$(Q.$$.fragment,t),Ne=!1},d(t){a(x),t&&a($e),t&&a(k),y(U),t&&a(ye),t&&a(N),y(J),t&&a(we),t&&a(u),y(R),y(q),y(W),t&&a(Me),t&&a(D),y(z),t&&a(xe),t&&a(w),t&&a(ke),t&&a(p),y(B),y(G),y(K),y(j),y(Q)}}}const la={local:"main-classes",sections:[{local:"evaluate.EvaluationModuleInfo",title:"EvaluationModuleInfo"},{local:"evaluate.EvaluationModule",title:"EvaluationModule"}],title:"Main classes"};function da(At){return sa(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ma extends ta{constructor(x){super();aa(this,x,da,ia,oa,{})}}export{ma as default,la as metadata};
