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 number of markets and resolution stats to the benchmark output #27

Merged
merged 3 commits into from
Feb 22, 2024

Conversation

kongzii
Copy link
Contributor

@kongzii kongzii commented Feb 22, 2024

Summary by CodeRabbit

  • New Features
    • Enhanced market information retrieval with a new method to gather overall market details.
    • Improved reporting by incorporating comprehensive market insights in markdown reports.

Copy link

coderabbitai bot commented Feb 22, 2024

Warning

Rate Limit Exceeded

@kongzii has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 31 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 7467b06 and ff2289b.

Walkthrough

The recent update introduces a new feature to the prediction market agent tooling by adding a method for retrieving comprehensive information about the markets. This includes data on the total number of markets, as well as the proportions of markets that have been resolved, and those that have ended in YES or NO outcomes. Additionally, the report generation function has been enhanced to incorporate this overall market information, providing a more detailed overview in the generated reports.

Changes

File Path Change Summary
.../benchmark/benchmark.py Added get_markets_overall_info method for overall market info retrieval and updated generate_markdown_report to include overall market info in the report.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between bc88190 and 32202f8.
Files selected for processing (1)
  • prediction_market_agent_tooling/benchmark/benchmark.py (2 hunks)
Additional comments: 1
prediction_market_agent_tooling/benchmark/benchmark.py (1)
  • 525-527: The update to generate_markdown_report method to include overall market information using pd.DataFrame(self.get_markets_overall_info()).to_markdown(index=False) is correctly implemented. This change effectively integrates the new market information into the benchmark report, enhancing its utility and informativeness. No issues or improvements are identified in this specific change.

Comment on lines 415 to 437
def get_markets_overall_info(self) -> dict[str, list[str | float]]:
return {
"Number of markets": [len(self.markets)],
"Proportion resolved": [
sum(1 for m in self.markets if m.is_resolved) / len(self.markets)
],
"Proportion YES": [
sum(
1
for m in self.markets
if m.probable_resolution == MarketResolution.YES
)
/ len(self.markets)
],
"Proportion NO": [
sum(
1
for m in self.markets
if m.probable_resolution == MarketResolution.NO
)
/ len(self.markets)
],
}
Copy link

Choose a reason for hiding this comment

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

The implementation of get_markets_overall_info method correctly calculates the overall market information, including the number of markets and their resolution proportions. However, consider using a more efficient approach for calculating proportions to improve readability and potentially performance. For example, you could calculate the total number of markets once and reuse it for each proportion calculation instead of calling len(self.markets) multiple times.

-                sum(1 for m in self.markets if m.is_resolved) / len(self.markets)
+                resolved_markets = sum(1 for m in self.markets if m.is_resolved)
+                total_markets = len(self.markets)
+                "Proportion resolved": [resolved_markets / total_markets],

Apply similar changes for "Proportion YES" and "Proportion NO".


Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
def get_markets_overall_info(self) -> dict[str, list[str | float]]:
return {
"Number of markets": [len(self.markets)],
"Proportion resolved": [
sum(1 for m in self.markets if m.is_resolved) / len(self.markets)
],
"Proportion YES": [
sum(
1
for m in self.markets
if m.probable_resolution == MarketResolution.YES
)
/ len(self.markets)
],
"Proportion NO": [
sum(
1
for m in self.markets
if m.probable_resolution == MarketResolution.NO
)
/ len(self.markets)
],
}
def get_markets_overall_info(self) -> dict[str, list[str | float]]:
resolved_markets = sum(1 for m in self.markets if m.is_resolved)
total_markets = len(self.markets)
return {
"Number of markets": [total_markets],
"Proportion resolved": [resolved_markets / total_markets],
"Proportion YES": [
sum(
1
for m in self.markets
if m.probable_resolution == MarketResolution.YES
)
/ total_markets
],
"Proportion NO": [
sum(
1
for m in self.markets
if m.probable_resolution == MarketResolution.NO
)
/ total_markets
],
}

@@ -498,6 +522,9 @@ def compute_expected_returns_summary(

def generate_markdown_report(self) -> str:
md = "# Comparison Report\n\n"
md += "## Overall Info\n\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit, but could rename Overall Info to Market Results, and adjust the heading structure below so it's

## Market Results
...

## Agent Results

### Summary Statistics

### Markets

### Expected value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Updated

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 32202f8 and 7467b06.
Files selected for processing (1)
  • prediction_market_agent_tooling/benchmark/benchmark.py (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • prediction_market_agent_tooling/benchmark/benchmark.py

@kongzii kongzii merged commit 1ecec3e into main Feb 22, 2024
8 checks passed
@kongzii kongzii deleted the peter/more-benchmark-info branch February 22, 2024 13:43
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