Skip to content

feat: SummaryModel增加type_count#448

Merged
shijinpjlab merged 3 commits into
MigoXLab:devfrom
shijinpjlab:dev_0710
Jul 13, 2026
Merged

feat: SummaryModel增加type_count#448
shijinpjlab merged 3 commits into
MigoXLab:devfrom
shijinpjlab:dev_0710

Conversation

@shijinpjlab

Copy link
Copy Markdown
Collaborator

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a type_count field to SummaryModel to store raw counts of evaluation labels, separating them from the calculated type_ratio percentages. It also adds a helper method _refresh_type_ratio to compute ratios from counts. A review comment highlights a performance issue where _refresh_type_ratio is unnecessarily called inside a loop for every processed item, suggesting its removal since the ratio is already refreshed in summarize.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread dingo/exec/local.py Outdated
Comment on lines +144 to +147
self.summary.score = round(
self.summary.num_good / self.summary.total * 100, 2
)
self._refresh_type_ratio(self.summary)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

在列表分析咉合中,为每个处理的数据项都调用 self._refresh_type_ratio(self.summary) 会导致严重的性能问题。
_refresh_type_ratio 需要遍历所有的字段和标签来重新计算比例,其时间复杂度为 $O(\text{fields} \times \text{labels})$。在处理大量数据时,这会在主循环中引入不必要的计算开销。

实际上＀

  1. write_single_data 并不依赖 type_ratio
  2. 每次写入 summary 时调用的 self.summarize(self.summary) 内部已经调用乆 _refresh_type_ratio
  3. execute 结束时,也会调用 self.summarize 来生成最终的 summary。

因此,建议移除此处的 self._refresh_type_ratio(self.summary)。如果需要确保 get_summary() 随时获取最新的 type_ratio,可以在 get_summary() 方法中按需调用 _refresh_type_ratio

Suggested change
self.summary.score = round(
self.summary.num_good / self.summary.total * 100, 2
)
self._refresh_type_ratio(self.summary)
self.summary.score = round(
self.summary.num_good / self.summary.total * 100, 2
)

@shijinpjlab shijinpjlab merged commit 555153e into MigoXLab:dev Jul 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant