Skip to content

Week7#6

Open
Ligo-code wants to merge 3 commits into
mainfrom
week7
Open

Week7#6
Ligo-code wants to merge 3 commits into
mainfrom
week7

Conversation

@Ligo-code
Copy link
Copy Markdown
Owner

No description provided.

@SohamMane812
Copy link
Copy Markdown

This is a clean, well-structured submission. The Q1 schema is correctly formed with the outer type: function wrapper from the start — better than most submissions. The Q2 prediction is accurate, specific, and includes the API call count reasoning. The Q3 comments correctly identify the tool/no-tool distinction and the Q3 Response B comment goes one level deeper than most by noting the model uses training knowledge for the boiling point. The Q6 role comment is concise and accurate. The Q7 comparison comment is clear. The project's system prompt instruction to use absolute paths returned from load_happiness_data is a smart defensive design choice, and the two custom queries are both genuinely interesting and require code generation.


Areas to improve

Warmup: Q4 — compute_correlation does not drop NaN rows

CsvManager.compute_correlation calls pearsonr(self.df[col1], self.df[col2]) directly without dropping NaN values first. scipy.stats.pearsonr raises a ValueError if either input contains NaN. The bike_commute dataset may not have NaNs so it won't crash during testing, but add .dropna() on the pair of columns before passing to pearsonr to make it robust.

Warmup: Q4 — plot_data uses plt.show() for the line case but plt.savefig() for the scatter case

The x is None branch calls plt.show() and returns without saving. The scatter branch calls plt.savefig("assignments_07/outputs/my_plot.png") but hardcodes a fixed filename regardless of what is being plotted. Both branches should save to a dynamic, meaningful path and return that path. With matplotlib.use("agg") set at the module level, plt.show() is a no-op and the line plot is silently discarded. Also note that plt.close() is missing after plt.savefig(), which means figures accumulate in memory across multiple calls.

Warmup: Q5 — run_agent_cycle is defined after tools_schema but before Q5 is labeled

The function run_agent_cycle is defined starting at line 531, but there is no Q5 label before it — the label appears only at the comment block after it. The assignment asks for clear section markers. Add a # Q5 comment directly above run_agent_cycle so the structure is clear.

Warmup: Q7 — compute_correlation_tool docstring is missing return type documentation

The docstring describes what the tool does and documents the args, but has no Returns: section. smolagents uses the docstring to build the tool description, and the return type annotation is -> dict but there is no description of what the dict contains. The agent will understand what to pass in but not what to expect back. Add a Returns: block describing the keys (col1, col2, pearson_r, p_value) so the tool is fully self-describing.

Warmup: Q8 — TOOLS list is missing several tools from the lesson

The TOOLS list in Q8 contains only load_csv_tool, plot_data_tool, and compute_correlation_tool. The full lesson TOOLS list includes list, get columns, summarize columns, and describe column as well. The assignment says "Create both a ToolCallingAgent and a CodeAgent using the same TOOLS list from the lesson." Using a reduced tools list means both agents are more limited than intended, and the Q8 reflection should account for this.

Warmup: Q8 — code_agent is instantiated without additional_authorized_imports

The CodeAgent is created with no additional_authorized_imports. When the agent tries to write matplotlib code for the green dot scatter plot, it may be blocked from importing matplotlib.pyplot. The lesson setup includes additional_authorized_imports=["matplotlib.pyplot", "pandas", "numpy"]. The macOS thread error you noted in the reflection is a separate issue, but the missing imports would also cause failures independently.

Project: Task 1 — compute_correlation does not drop NaN rows

Same issue as the warmup: pearsonr(df[col1], df[col2]) is called without .dropna(). Add clean = df[[col1, col2]].dropna() and use clean[col1] and clean[col2] in the pearsonr call.

Project: Task 3 — plot existence is not verified

The assignment asks you to verify that outputs/happiness_by_region.png is saved to disk after running. There is a print("\nExpected plot location:") and print(PLOT_PATH) but no check that the file actually exists. Add print(PLOT_PATH.exists()) or an assert so it's clear whether the plot was actually created.

Project: Task 5 — Reflection Q3 is slightly incomplete

You correctly noted the p-value was 0.0 and the threshold was 0.05. It would be one step stronger to also note what the Pearson r value was and what the direction and strength of the correlation means in context — not just that it was significant, but what the number actually tells you about the relationship between GDP per capita and happiness score.

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