Help with Formula/ Power Query to calculate Precision and Recall metrics


Hi Team,

I have the coding data generated by an automated model and then the coding data being generated by a human agent..I want to compare the same to generate the two metrics -precision and recall...In my input file the data is at a ctextid ,vbillid level...I need to compared the agentcode -code generated by human versus the predictcode (code generated by human)..

The precision metric is calculated as follows: Overlap of count of codes between agentcode and predictcode/ len(predictcode) *100
The recall metric is calculated as follows:Overlap of count of codes between agentcode and predictcode/ len(agentcode) *100

Can you please help me here...


4 Replies

@Arun Chandramouli Perhaps 1power Query is what you need. See attached.


@Arun Chandramouli 

Please check in attached.

Hi @Sergei: The power query is predicting based on the occurence of the codes...But it should be considering only the number of codes intersecting...
ctextid vbillid agentcode predictcode precision recall
1171 23 H6692,J309 J309, H6692 50.0% 50.0%
I am getting the above result...Both precision and recall should be 100% here...

@Arun Chandramouli 

That's since extra space between codes which was considered as part of the code. I trim the spaces, now