Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a section to show model average score for all eval data #4050

Merged
merged 5 commits into from
Mar 20, 2024

Conversation

shifucun
Copy link
Contributor

@shifucun shifucun commented Mar 19, 2024

Score for each model is passed from child component to the App. Use state in the parent component is very slow due to the large number of children components. Here uses a ref object to collect and a timer to check if all scores have been collected.

Also

  • Updated some golden stat vars which are not good match
  • Removed SDG queries since the current golden is for base medium index.

@shifucun shifucun requested a review from chejennifer March 19, 2024 21:14
Copy link
Contributor

@chejennifer chejennifer left a comment

Choose a reason for hiding this comment

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

This is cool! Can you also include a screenshot of what this looks like?

isExpanded: boolean;
goldenStatVars: string[];
overrideStatVars: EmbeddingObject[];
setScore: (modelName: string, sentence: string, score: number) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add a comment about what score we're setting here? maybe also rename to onScoreUpdated (here and everywhere else)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated


import { stringifyFn } from "../../utils/axios";
import { QuerySection } from "./query_section";
import { EmbeddingObject } from "./util";

function OverallScoreTable(props: {
Copy link
Contributor

Choose a reason for hiding this comment

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

have a separate file for this component?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


import { stringifyFn } from "../../utils/axios";
import { QuerySection } from "./query_section";
import { EmbeddingObject } from "./util";

function OverallScoreTable(props: {
data: Record<string, Record<string, number>>;
count: number;
Copy link
Contributor

Choose a reason for hiding this comment

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

add a comment about what this is a count of? or have a better name

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


import { stringifyFn } from "../../utils/axios";
import { QuerySection } from "./query_section";
import { EmbeddingObject } from "./util";

function OverallScoreTable(props: {
data: Record<string, Record<string, number>>;
Copy link
Contributor

Choose a reason for hiding this comment

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

comment what the keys and values are?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

useEffect(() => {
// Check if data is complete. If so, set mark to an empty string so that no
// new render is triggered.
if (Object.values(Object.values(props.data)[0]).length === props.count) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is Object.values(props.data) always going to be non empty? If it can be empty, should check before accessing the first element

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not needed anymore as the logic is moved to App where each model should have the same length of values as the eval dataset.

return;
}
// Update mark to be a new timestamp frequently if data is not complete
const timerId = setInterval(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of the mark and timer, could this work:

  • add a new completedOverallScore state in App component
  • in handleUpdateOverallScore, check if scores are complete. If complete, update completedOverallScore
  • pass completedOverallScore to OverallScoreTable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a really good suggestion. Works perfect.

Copy link
Contributor Author

@shifucun shifucun left a comment

Choose a reason for hiding this comment

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

Thanks for the review, it's very helpful!


import { stringifyFn } from "../../utils/axios";
import { QuerySection } from "./query_section";
import { EmbeddingObject } from "./util";

function OverallScoreTable(props: {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


import { stringifyFn } from "../../utils/axios";
import { QuerySection } from "./query_section";
import { EmbeddingObject } from "./util";

function OverallScoreTable(props: {
data: Record<string, Record<string, number>>;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


import { stringifyFn } from "../../utils/axios";
import { QuerySection } from "./query_section";
import { EmbeddingObject } from "./util";

function OverallScoreTable(props: {
data: Record<string, Record<string, number>>;
count: number;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

isExpanded: boolean;
goldenStatVars: string[];
overrideStatVars: EmbeddingObject[];
setScore: (modelName: string, sentence: string, score: number) => void;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

return;
}
// Update mark to be a new timestamp frequently if data is not complete
const timerId = setInterval(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a really good suggestion. Works perfect.

useEffect(() => {
// Check if data is complete. If so, set mark to an empty string so that no
// new render is triggered.
if (Object.values(Object.values(props.data)[0]).length === props.count) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not needed anymore as the logic is moved to App where each model should have the same length of values as the eval dataset.

@shifucun shifucun requested a review from chejennifer March 20, 2024 02:44
Copy link
Contributor

@chejennifer chejennifer left a comment

Choose a reason for hiding this comment

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

thanks for the changes!

@shifucun shifucun enabled auto-merge (squash) March 20, 2024 16:32
@shifucun shifucun merged commit 9063c6c into datacommonsorg:master Mar 20, 2024
9 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.

2 participants