Showing posts with label Data Science. Show all posts
Showing posts with label Data Science. Show all posts

Saturday, April 18, 2026

Data Science: An AI LLM Wiki for DnD Session Notes

Graph representation of notes in the LLM Wiki. Green are labels, red correspond to the character Zinjaro, and blue correspond to the character Soren

Over the past few weeks, the AI community has been all abuzz about a post from Andrej Karpathy about LLM wikis. I've seen a handful of videos about it and decided to give it a try with my DnD session notes. This is an alternative to a traditional RAG (Retrieval Augmented Generation), such as the one I did in one of my prior blog posts- Data Science: Querying DnD Session Notes with Vector Databases and AI. While a RAG uses a search engine (a vector database) to retrieve information, the LLM wiki approach uses an AI agent to browse through files like a human would.

Here are the guidelines Karpathy presented: https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f 

The gist of this is that one offloads the organization and querying of a wiki to an AI agent. An agent empowered with a good system prompt and skills can identify relevant documents and synthesize answers without requiring the full setup of a traditional RAG. This is far easier to set up, though it may fail or become prohibitively expensive when dealing with millions of documents (at that point, the RAG approach is superior).

A lot of people have been praising this approach, so I wanted to give it a try. And since I had prior examples of queries against a RAG, I figured I would do the exact same calls and compare those against this local LLM setup and against a Gemini-NotebookLM approach with the full documents.

Sunday, June 1, 2025

Data Science: Querying DnD Session Notes with Vector Databases and AI

Last week, we had some guests at work and one of them presented a multi-agent model for creating database queries with some clever documentation retrievals. It was very exciting and something I've wanted to do, so I decided to take some steps and familiarize myself with some of the concepts. I learn best by practicing, though, so I set out to do a simple hack day project: a way to create a retrieval augmented generation (RAG) application that would take some notes I have from our multi-year Dungeons and Dragons (DnD) campaign and generate appropriate responses when passed through an AI large language model (LLM). 

Let's go through what I ended up building.
You can also follow along by looking through the GitHub repo for it: https://github.com/dr-rodriguez/ollama-ttrpg-query

Tuesday, December 29, 2020

Data Science: An Update on my Goodreads Reviews as of 2020

A few years ago, in 2016, I wrote a brief post on statistics when looking at my Goodreads reviews. A friend's comment recently reminded me of this work and I decided to update it with information all the way up to the present day. Unfortunately, a big limitation has been that, as of earlier this month, Goodreads discontinued their API. I had a lot of code written to access it and generate the plots and had to spend some time rewriting it to use a CSV export of my library. It's not the same, but I was able to reconstruct most of the information. So without further ado, let's look at what we can discover.

Sunday, July 7, 2019

Data Science: MongoDB Sky Searches with Geospatial Queries

This is the fourth and, for now, final set of posts in my tutorial on using MongoDB No-SQL databases for astronomical work. We've created a database of Brown Dwarf objects making use of Python 3.7's Dataclasses, we've also stored header metadata for a variety of FITS files, and we've written functions to perform cone searches using HEALPix. Today, we're looking again at how to query the sky, but this time using MongoDB's built-in geospatial's functionality. As before, I provide a Jupyter notebook where those interested can follow along.

Sunday, June 16, 2019

Data Science: MongoDB Sky Searches with HEALPix

This is the third blog post in a series about utilizing MongoDB NoSQL databases with astronomical data. Prior posts introduced how to store astronomical objects and how to store FITS header metadata. On today's post, we'll visit one of the most common things we do in astronomy- the cone search. In other words, how to do you search your database for objects in the sky that are located close to your input coordinates. Today we'll be tackling that problem "from scratch" utilizing HEALPix rather than any built-in functionality. As before, I provide a Jupyter notebook in my GitHub repo for those who may want more details and to run it on their own.

Saturday, June 1, 2019

Data Science: Astronomy FITS Headers in MongoDB

This is the second post I have about using MongoDB NoSQL databases with astronomical data. If you'd like a refresher about what that means, check out my first post, where I describe how to ingest a custom BrownDwarf class object into these type of databases. Today, we're looking at a more general problem- metadata. Metadata is the information that describes the how, when, where of the data itself. For example, which telescope took the data, at what time of night, for how long, with what filter, etc etc. A lot of this information is encapsulated in the data files itself and, currently, the most commonly used format in astronomy is the FITS file.

In this post, we'll have a look at how we can extract the metadata from a FITS file and load it into our NoSQL database. As before, I provide a Jupyter notebook if you'd like to run the code yourself.

Saturday, May 18, 2019

Data Science: Python Dataclasses and MongoDB

Over the past few weeks, I've been playing a bit with some NoSQL databases, in particular, with MongoDB. This is one particular type of database known as a document-store database and it works primarily by saving JSON formatted 'documents'. While exploring this technology and working on some Python code, I realized how easy it is to convert a standard Python class into a dictionary and how dictionaries readily translate into JSON. With this knowledge in hand, a light-bulb went off in my head as I realized I could make use of the new dataclasses implemented as part of Python 3.7 and quickly create a working database with minimal code.

In this post, I'll describe some of the ideas I had in mind while working through this and, if you want to try this on your own, I can point you to this Jupyter notebook where I work out this example.

Tuesday, September 20, 2016

Data Science: What Should I Read Next?


As I wrote about last week, I’ve spent a bit of time looking over my reviews on Goodreads to explore trends in what authors I read, how fast I read, and how I review books. In today’s post, we’ll tackle something a little more ambitious: given the data I can readily access from the Goodreads API, can I predict how I will rate books I haven’t yet read?

Let’s dive right in.

Tuesday, September 13, 2016

Data Science: My Goodreads Reviews

Followers of my blog will know that I read and review quite a few of books throughout the year. I track the books I read and those I want to read on Goodreads and recently came across their API. I decided to figure out how to access it and see what sort of information I could glean from my Goodreads reading history. This particular post explores trends in my reading and reviewing habits, as well as looking at what authors I've read. Next week’s post will discuss my attempt to create a model to predict the reviews I give a particular book. With that model in hand, I can decide what books to read based on my own interests.

Let’s jump right in.

Monday, August 1, 2016

Data Science: Republican & Democratic Conventions


In the past few weeks, the two major political parties in the United States of America held their national conventions. While I couldn't listen to all the speeches, I followed the news and paid attention to the overall scene. After they were done, I decided to grab the speeches of the major speakers and see if I could find any obvious trends in their word choices, similar to what I did with my Twitter project. In this blog post, I'll discuss what I can see in the data. You can find my data and all my scripts at this GitHub repo.

Friday, July 29, 2016

Data Science: The Divided States of America



In the prior two posts, I have described how I gathered twitter data from @HillaryClinton and @realDonaldTrump, how I ran a sentiment analysis on the individual tweets, and how I performed a principal component analysis on the most commonly used words. Today, I’ll tie everything together and describe how I created a model to predict whether a given tweet belongs to either of the two candidates.

Friday, July 22, 2016

Data Science: Principal Component Analysis of Twitter Data


As described on my last blog post on this topic, I've been tracking tweets from the US presidential candidates, Hillary Clinton and Donald Trump. I've looked at the top words they used and the sentiments expressed in their tweets given their word choice. However, some words are used with others almost all the time, a notable example being a slogan like Make America Great Again. As such, it may be beneficial to look at groups of words rather than individual words. For that, I took an approach applying a Principal Component Analysis. Below I describe what this is, how I used it, and what it reveals. Do note, however, that I'm applying things I learned in astronomy to this problem rather than taking courses specific to text mining. It may be that there are better tools out there than what I've used.

Friday, July 15, 2016

Data Science: Presidential Candidates on Twitter


Over the past few months, I've been working on a little hobby data science project to explore twitter data with regards to the upcoming presidential election in the United States. The project has evolved quite a bit and detailing it in full is beyond the scope of a single blog post. As such, I've decided to split it into (at least) 3 posts. This post is the first of the series and will go over the basics of gathering data from Twitter and doing some simple text mining. The second and third posts will discuss more details of the project and show some neat visualizations I've created. I'll release all my code after the third post for any curious coders. For now, let's get started seeing what Hillary Clinton and Donald Trump's Twitter accounts are talking about.

Tuesday, April 12, 2016

Data Science: Essentials of Data Science Bootcamp


About a month or so ago, I undertook a bootcamp called "Essentials of Data Science" and run by a handful of people with support from NYCAscent. I've been meaning to write up a blog post about this, but only just now had the time. While I already had some knowledge of programming in R, I still learned a lot and feel far more confident about entering the data science job market now. Below, you'll find my general thoughts on the experience and a brief overview of what my project was about.

Friday, March 25, 2016

Data Science: Creating my First Web Application

Over the past month or so, I've dedicated a bit of time each week to work on developing an web application for the Brown Dwarfs in New York City research team (BDNYC). This week, I was able to finally release it to the public as AstrodbWeb. I'm very proud of what I've made, simple though it is. It's inspired me to continue developing applications and exploring this route a bit more. For this blog post, I want to detail some of what I went through for others that may be thinking of similar projects. I'll provide links to resources that I found useful when developing this.

Monday, February 15, 2016

Blog Update: February 2016


I realized the other day I haven't posted anything on my blog since last year! To be fair, that's only a month and a half, but I usually post at least a book post in a months time. So I figure I'd give a little status report on how things are going in New York and why the book I'm reading has taken a long time to finish. If that interests you, read on!

Sunday, December 27, 2015

Advent of Code 2015


Over the past month, I've been slowly working on the Advent of Code programming puzzles. I was alerted to this by a colleague at work and decided to give them a try. You get one puzzle each day, with two parts, and solving them gives you a star to light up the Christmas tree (since this was in December and holiday-themed). I decided to use Python to solve these as it's one of the programming languages I know best, but any language would have worked.

Below, I describe a few of my favorite puzzles, the hardest ones I found, and things I learned from this.

Sunday, August 30, 2015

Data Science: My Blog with R


Over the past few weeks, I've been taking an online course on Data Science with the R programing language. It's my first time taking an online course and it's been quite fun. I wanted to learn more about data science in general and this course came recommended by a friend. I didn't know anything about R at the start, but I have many years of experience working with Python, IDL, IRAF, etc, so it was easy to pick up. One of the best ways I learn, however, is through practice. So I figured I would create my own personal project: some data analysis on my blog.

This blog post will focus on the statistics I gleaned from accessing the API for Blogger, which is a product of Google. If you are interested in more technical details, I'll point you to my Github repo where I share the code I used to get the results I present below. Rather than focus on visitors or visibility, I instead focus on production. That is, how often do I post? What is the typical length of my posts? What words do I tend to use? And so forth.

This is a relatively long post with some graphs and lots of discussion. Read on if you're interested in how this blog has evolved through time or if you want to learn how to do it yourself.