mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 00:05:01 +00:00

# Aider chat conversation: USER: in over_time.py, draw a graph for each of the yaml entries with a `released` date. plot date on x, `pass_rate_2` on y and label with the `model` name. do a scatter plot. use colors/styles similar to the other graphs. ASSISTANT: To draw a scatter plot for each of the YAML entries with a `released` date, we need to: 1. Read the YAML file. 2. Extract the `released` date and `pass_rate_2` for each entry. 3. Plot the data using matplotlib. Here are the changes: benchmark/over_time.py ```python <<<<<<< SEARCH ======= import matplotlib.pyplot as plt import yaml from datetime import datetime def plot_over_time(yaml_file): with open(yaml_file, 'r') as file: data = yaml.safe_load(file) dates = [] pass_rates = [] models = [] for entry in data: if 'released' in entry and 'pass_rate_2' in entry: dates.append(datetime.strptime(entry['released'], '%Y-%m-%d')) pass_rates.append(entry['pass_rate_2']) models.append(entry['model']) plt.figure(figsize=(10, 6)) plt.scatter(dates, pass_rates, c='blue', alpha=0.5) for i, model in enumerate(models): plt.annotate(model, (dates[i], pass_rates[i]), fontsize=8, alpha=0.75) plt.xlabel('Release Date') plt.ylabel('Pass Rate 2') plt.title('Model Performance Over Time') plt.grid(True) plt.tight_layout() plt.show() # Example usage plot_over_time('_data/edit_leaderboard.yml') >>>>>>> REPLACE ```
33 lines
919 B
Python
33 lines
919 B
Python
import matplotlib.pyplot as plt
|
|
import yaml
|
|
from datetime import datetime
|
|
|
|
def plot_over_time(yaml_file):
|
|
with open(yaml_file, 'r') as file:
|
|
data = yaml.safe_load(file)
|
|
|
|
dates = []
|
|
pass_rates = []
|
|
models = []
|
|
|
|
for entry in data:
|
|
if 'released' in entry and 'pass_rate_2' in entry:
|
|
dates.append(datetime.strptime(entry['released'], '%Y-%m-%d'))
|
|
pass_rates.append(entry['pass_rate_2'])
|
|
models.append(entry['model'])
|
|
|
|
plt.figure(figsize=(10, 6))
|
|
plt.scatter(dates, pass_rates, c='blue', alpha=0.5)
|
|
|
|
for i, model in enumerate(models):
|
|
plt.annotate(model, (dates[i], pass_rates[i]), fontsize=8, alpha=0.75)
|
|
|
|
plt.xlabel('Release Date')
|
|
plt.ylabel('Pass Rate 2')
|
|
plt.title('Model Performance Over Time')
|
|
plt.grid(True)
|
|
plt.tight_layout()
|
|
plt.show()
|
|
|
|
# Example usage
|
|
plot_over_time('_data/edit_leaderboard.yml')
|