manishshettym / codescholar

codescholar: growing programs graphs idiomatically for API usage examples
10 stars 0 forks source link

Improve the presentation of an idiom #23

Closed manishshettym closed 8 months ago

manishshettym commented 8 months ago

https://github.com/tart-proj/codescholar/blob/9914b8f1c2079ef7a709d6e6d0f6b06132006e8e/codescholar/search/search.py#L42

This function currently takes a bunch of idioms generated and saves the partial programs (partial sasts transformed) python files. This is not ideal:

  1. the presentation lacks clarity -- a partial prog, esp., for a small-sized idiom, has very less info.
  2. the presentation lacks context -- a partial prog is concise but loses a lot of the context of the problem itself (surrounding code)
  3. the presentation lacks provenance-- a partial prog (presented as an idiom) has separated from the original function; hence the promise of provenance (to a github program) is lost.
manishshettym commented 8 months ago

Ideal presentation:


# https://github.com/opium-sh/prl/blob/3e21f8c7c87cfc7aee84d9e264c3a8b2bc549076/prl/callbacks/callbacks.py#L345

# def on_iteration_end(self, agent: AgentABC):
    # agent_logs = agent_logger.flush(self.agent_logger_cid)
    # mean_test_reward = np.mean(agent_logs[0]["test_episode_total_reward"])
    mean_test_episode_length = np.mean(agent_logs[0]["test_episode_length"])
    # history_summary = (mean_test_reward, mean_test_episode_length)
    # if self.on_screen:
        # self._log_on_screen(agent.iteration_count, history_summary)

    # if self.to_file:
        # self._log_to_file(agent.iteration_count, history_summary)

Highlight the "idiomatic" partial program in context of the overall function.