This is a comprehensive, hands-on workshop that guides participants from Python fundamentals to practical AI applications using large language models (LLMs). The session begins by establishing a foundation in core Python concepts, including variables, data types, operators, control flow structures (if/else, loops), and function definitions, all within the Google Colab environment.
The workshop then transitions to scientific computing, introducing essential libraries like NumPy for numerical operations on arrays and Pandas for manipulating tabular data in DataFrames. The instructor demonstrates how to load, explore, and visualize a dataset using Pandas and Seaborn.
The final, major section focuses on AI workflows. It distinguishes between running local, open-source models (Gemma) and querying powerful, cloud-hosted models via an API (Gemini). The instructor walks through the process of setting up credentials on Kaggle and Google AI Studio, downloading and running a local Gemma model, and managing its conversational context. The session culminates in a practical example where a Pandas DataFrame is converted to text and fed to the Gemini API to perform data analysis and generate insights based on a natural language prompt.
An Introduction to Python and AI for Researchers
00:00:19 Introduction: The session begins with an introduction to the instructor, Nathaniel (Nate) Butterworth, and the workshop's goal: to build a foundation in Python for research and introduce its AI capabilities.
00:02:12 Google Colab Environment: The workshop is conducted using Google Colab, a free, browser-based Python notebook environment that requires no local installation. Alternatives like VS Code and Anaconda are also mentioned.
00:08:20 Python Fundamentals: The basics of Python are covered, including defining variables, fundamental data types (strings, integers, floats, booleans), and using arithmetic, comparison, and logical operators.
00:16:46 Data Structures - Lists: The instructor introduces Python lists for storing collections of items, demonstrating how to create them, access elements via indexing, and use methods like len() and .append().
00:23:23 Control Flow: This section covers essential control flow statements:
Conditional Statements: Using if, elif, and else to execute code based on conditions.
Loops: Using for loops to iterate over items and while loops to run code until a condition is met.
00:38:14 Defining Functions: Learn how to create reusable blocks of code by defining custom functions with the def keyword, including parameters, docstrings, and return values.
00:52:36 Numerical Python with NumPy: Introduction to the NumPy library for efficient numerical computation. Key takeaway: NumPy arrays allow for fast, vectorized operations (e.g., adding a number to every element at once), which is not possible with standard Python lists.
01:06:53 Data Analysis with Pandas: The Pandas library is introduced as the primary tool for working with tabular data. The instructor shows how to create a DataFrame from a Python dictionary and use methods like .info(), .describe(), .head(), and data filtering to explore the data.
01:22:06 Introduction to LLMs: Gemma vs. Gemini: The workshop explains the difference between Gemma (open-source models that can be run locally) and Gemini (powerful, closed-source models accessed via an API).
01:26:16 Running a Local LLM (Gemma): The instructor guides users through setting up a Kaggle account, accepting the model license, and generating an API key to programmatically download a Gemma model using the Keras library.
02:03:42 Managing Conversation Context: A key concept is demonstrated: local models are stateless. To have a conversation, the entire history of prompts and responses must be passed with each new query. A function is built to manage this context.
02:14:50 Querying a Cloud-Hosted LLM (Gemini): The workshop shows how to get a Google AI Studio API key to access the more powerful Gemini models. This allows for more accurate and sophisticated responses without requiring powerful local hardware.
02:48:26 Applying an LLM to a Dataset: The final exercise demonstrates a practical workflow:
A sample dataset is loaded using Pandas.
The DataFrame is converted into a text string using the .to_string() method, as LLMs primarily process text.
A detailed prompt is crafted, providing the text-based data and asking specific questions about it.
The prompt is sent to the Gemini API, which returns a detailed, human-like analysis of the data.