1"use strict";(self.webpackChunkais_package_github_io=self.webpackChunkais_package_github_io||[]).push([[2680],{28453:(e,t,s)=>{s.d(t,{R:()=>c,x:()=>a});var n=s(96540);const r={},i=n.createContext(r);function c(e){const t=n.useContext(i);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:c(e.components),n.createElement(i.Provider,{value:t},e.children)}},65049:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>o,contentTitle:()=>a,default:()=>u,frontMatter:()=>c,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"advanced-guides/Utils/Metrics","title":"Metrics","description":"The metrics file provides utilities to measure, analyze, and compare the performance of the package\'s algorithms in a standardized way.","source":"@site/versioned_docs/version-0.1.x/advanced-guides/Utils/Metrics.md","sourceDirName":"advanced-guides/Utils","slug":"/advanced-guides/Utils/Metrics","permalink":"/docs/0.1.x/advanced-guides/Utils/Metrics","draft":false,"unlisted":false,"tags":[],"version":"0.1.x","lastUpdatedBy":"Jo\xe3o Paulo","lastUpdatedAt":1781982648000,"sidebarPosition":1,"frontMatter":{"sidebar_position":1,"title":"Metrics","sidebar_label":"Metrics","lastUpdatedAt":"2025/04/04","author":"Jo\xe3o Paulo"},"sidebar":"docs","previous":{"title":"Negative Selection","permalink":"/docs/0.1.x/advanced-guides/Core/Negative Selection"},"next":{"title":"Multiclass","permalink":"/docs/0.1.x/advanced-guides/Utils/Multiclass"}}');var r=s(74848),i=s(28453);const c={sidebar_position:1,title:"Metrics",sidebar_label:"Metrics",lastUpdatedAt:"2025/04/04",author:"Jo\xe3o Paulo"},a=void 0,o={},d=[{value:"def accuracy_score(...)",id:"def-accuracy_score",level:2}];function l(e){const t={code:"code",em:"em",h2:"h2",hr:"hr",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.p,{children:"The metrics file provides utilities to measure, analyze, and compare the performance of the package's algorithms in a standardized way."}),"\n",(0,r.jsx)(t.h2,{id:"def-accuracy_score",children:"def accuracy_score(...)"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-python",children:"def accuracy_score(\n y_true: Union[npt.NDArray, list],\n y_pred: Union[npt.NDArray, list]\n) -> float\n"})}),"\n",(0,r.jsx)(t.p,{children:"Function to calculate precision accuracy based on lists of true labels and\npredicted labels."}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.strong,{children:"Parameters"}),":"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.strong,{children:(0,r.jsx)(t.em,{children:"y_true"})})," (",(0,r.jsx)(t.code,{children:"Union[npt.NDArray, list]"}),"): Ground truth (correct) labels.\nExpected to be of the same length as ",(0,r.jsx)(t.code,{children:"y_pred"}),"."]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.strong,{children:(0,r.jsx)(t.em,{children:"y_pred"})})," (",(0,r.jsx)(t.code,{children:"Union[npt.NDArray, list]"}),"): Predicted labels. Expected to\nbe of the same length as ",(0,r.jsx)(t.code,{children:"y_true"}),"."]}),"\n"]}),"\n",(0,r.jsx)(t.p,{children:"Returns:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.strong,{children:(0,r.jsx)(t.em,{children:"Accuracy"})})," (",(0,r.jsx)(t.code,{children:"float"}),"): The ratio of correct predictions to the total\nnumber of predictions."]}),"\n"]}),"\n",(0,r.jsxs)(t.p,{children:[(0,r.jsx)(t.strong,{children:"Raises"}),":"]}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.code,{children:"ValueError"}),": If ",(0,r.jsx)(t.code,{children:"y_true"})," or ",(0,r.jsx)(t.code,{children:"y_pred"})," are empty or if they do not have the same length."]}),"\n"]}),"\n",(0,r.jsx)(t.hr,{})]})}function u(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.