Code generation and optimization

Last updated on 2024-09-13 | Edit this page

Estimated time: 0 minutes

Overview

Questions

TODO

Objectives

  • Generate snippets of code using Codeium as AI-assistant
  • Optimize performance of the generated code using Codeium as AI-assistant
  • Refactor and improve the structure and quality of existing code using Codeium as AI-assistant
  • Identify and fix bugs using Codeium as AI-assistant

TODO

Challenge

Exercise 1: Code and Functions Generation

Objective: Generate snippets of code using Codeium as AI-assistant

Instructions: Using Codeium as AI-assistant: - Read a datafile into a Pandas DataFrame object, produce datafile descriptives and plot the data distributions. - Write a function that takes as input a DataFrame and that calculates basic descriptive statistics like: number of rows (nrow), number of columns (ncol), data types of each column, basic summary statistics (like mean, min, max for numeric columns). - Write a function that takes as inputs a DataFrame and a column and generate an histogram to visualize data distribution if the column is numeric (e.g., int64, float64), a bar plot showing the category frequency if the column is categorical. - Review the AI-generated code and compare it to the version you would have written independently without the AI-assistant.

TODO

Challenge

Exercise 2: Optimization with Codeium Objective: Use Codeium to improve existing code

Instructions: - Provide a sample code that needs optimization (will be an example from the medical field or, alternatively, I’ll search on stack exchange) - Use Codeium to suggest improvements and restructure the code - Compare the original and restructured versions (clarity, length…)

TODO

Challenge

Exercise 3: Debugging Assistance Objective: Use Codeium to identify and fix bugs

Instructions: - You are presented with a code snippet with errors - Use Codeium to detect and propose fixes - Apply and test the corrections

Key Points

TODO