Skip to content

Instantly share code, notes, and snippets.

View kanhua's full-sized avatar

Kan-Hua Lee kanhua

View GitHub Profile
@kanhua
kanhua / gist:16b60beebfbc90f40795ddb3208d220e
Created May 17, 2026 14:27
Knowledge system for AI-run scientific experiments
# Knowledge system for AI-run scientific experiments
## Core idea
This note proposes a knowledge system for long-running scientific projects where AI agents can execute experiments: machine learning, computational physics, computational biology, and similar domains with automated evaluation loops. The pattern is drawn from a year of operating an Obsidian-vault-backed lab notebook alongside a Claude Code agent on an event-vision ML project, but the structure generalizes.
Auto-research systems such as [Sakana AI's AI Scientist](https://sakana.ai/ai-scientist/) and [Hugging Face's ml-intern](https://github.com/huggingface/ml-intern) already show how agents can generate ideas and execute individual experiments. For projects that run for months, the harder problem is keeping accumulated knowledge organized so both the agent and the human can return later and pick up the thread.
The system below treats the project notebook as a layered, queryable knowledge base. Each layer is defined by who writes it, who read
@kanhua
kanhua / DLFTS calculation.ipynb
Last active October 2, 2018 06:16
Demo of Deep Level Fourier Transient Spectroscopy (DLFTS)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kanhua
kanhua / quarter_polar_plot.py
Created October 1, 2017 14:53
Quarter polar plot with matplotlib
"""
Reference:
1. https://gist.github.com/ycopin/3342888
2. http://matplotlib.org/mpl_toolkits/axes_grid/users/overview.html#axisartist
"""
import numpy as np
import matplotlib.pyplot as plt
@kanhua
kanhua / README.md
Last active December 4, 2024 08:04
A template of writing C or C++ extension for python and numpy

This gist demonstrates how to setup a python project that process a numpy array from C language.

To compile the project, run

make all

To test it, run

make test
@kanhua
kanhua / pandas_groupby
Created July 3, 2015 13:14
pandas groupby
{
"cells": [
{
"cell_type": "code",
"execution_count": 48,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
@kanhua
kanhua / monte_carlo_pi.jl
Created October 27, 2014 15:01
Calculate Pi using monte carlo method
# Calculate Pi using monte carlo method
function estimate_pi_vec()
# Vectorized way of calculating Pi
# This style is commonly seen in python or Matlab/Octave to avoid for loops
samplenum=100000000
mc_x=rand(samplenum,1)
mc_y=rand(samplenum,1)
@kanhua
kanhua / titanicSubmit
Created October 23, 2014 15:03
Submit Kaggle Titanic results (not optimised!)
{
"metadata": {
"language": "Julia",
"name": "",
"signature": "sha256:999e48e1cfeb072e56d4089a89783a9483f6c014acc704990d74ba7079a57434"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
@kanhua
kanhua / titanicAnalysis
Last active August 29, 2015 14:07
Explore the Titanic data on Kaggle
{
"metadata": {
"language": "Julia",
"name": "",
"signature": "sha256:6394928c631f491d9b3776e1af071144d00c1446e0ec4d032c094af7b3d8edd6"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
@kanhua
kanhua / julia2048_basic.jl
Created October 9, 2014 14:44
A simple terminal 2048 game written in julia language
const ContinueGame=999
const WinGame=777
const LoseGame=444
const QuitGame=-99
function move(line,direction)
lineLen=length(line)
nonZeroLine=line[line.>0]
@kanhua
kanhua / .gitignore
Last active August 29, 2015 14:06 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #