import numpy as np
import pandas as pd
import shap
import lime
import lime.lime_tabular
import matplotlib.pyplot as plt
from sklearn.datasets import load_diabetes
from sklearn.model_selection import train_test_split
from xgboost import XGBRegressor
# ✅ Load dataset
data = load_diabetes()
X = pd.DataFrame(data.data, columns=data.feature_names)
y = data.target
# ✅ Train-test split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# ✅ Train XGBoost regressor
model = XGBRegressor(n_estimators=100, random_state=42)
model.fit(X_train, y_train)
# ✅ Predict on test set
preds = model.predict(X_test)
# ==============================================
# 🔷 Part A: SHAP Values
# ==============================================
# ✅ Initialize SHAP explainer
explainer = shap.Explainer(model, X_train)
# ✅ Explain predictions on test set
shap_values = explainer(X_test)
# ✅ Visualize feature importance (global)
shap.plots.beeswarm(shap_values)
# ✅ Explain a single prediction (local)
shap.plots.waterfall(shap_values[0])
# ==============================================
# 🔷 Part B: LIME
# ==============================================
# ✅ Initialize LIME explainer
lime_explainer = lime.lime_tabular.LimeTabularExplainer(
X_train.values,
feature_names=X_train.columns.tolist(),
verbose=True,
mode='regression'
)
# ✅ Explain a single instance
i = 0 # index of sample to explain
lime_exp = lime_explainer.explain_instance(
X_test.values[i],
model.predict,
num_features=5
)
# ✅ Visualize LIME explanation
lime_exp.show_in_notebook(show_table=True)
# If running in script, use
# lime_exp.as_pyplot_figure()
# plt.show()
- SHAP provides both global and local explanations with theoretical guarantees based on Shapley values (fair feature attribution).
- LIME builds a local surrogate model to approximate the black-box behavior near a specific prediction, giving intuitive explanations quickly.
- Limitations: SHAP can be computationally heavy; LIME explanations may vary due to random perturbations.
Both are widely used for model interpretability in regulated industries like life sciences, where explainability is critical for compliance and stakeholder trust.
We should think in terms of "this is a function to generate sequences" and "by providing prefixes we can steer the sequence generation around in the space of words and change the probabilities for output sequences". And for every possible undesirable output sequence of a length smaller than , we can pick a context that maximizes the probability of this undesirable output sequence.
A much clearer formulation, which helps more clearly articulate the problems to solve.
Here is a concise Kannada-Hangul alphabet chart mapping roughly equivalent sounds. Note: Korean lacks many exact equivalents, so these are approximate phonetic mappings.
EvalOps is the control plane for AI evaluation and routing. It helps teams compare LLMs, track performance, and automatically send each request to the best LLM.
EvalOps turns evals into your release contract
scorecards,
scenarios,
monitors, and
CI gates that keep quality from drifting and get you out of POC purgatory.
The Pillar worklow:
Define -- Scorecards establish quality metrics
Test -- Scenarios provide comprehensive coverage
Gate -- CI Gates block regressions
Monitor -- Continuous production oversight
The LLM quality problem -- Traditional testing breaks down with LLMs. Non-deterministic outputs, subjective quality metrics, and emergent behaviors make it impossible to ensure quality with conventional approaches.
60% of teams deploy untested changes -- No systematic way to validate LLM quality before production
Average 4 hours per regression -- Time spent debugging issues that reach production
Manual evaluation bottlenecks -- Human reviewers can't scale with deployment frequency
Sphinx is a powerful documentation generator that supports multiple programming languages and markup formats. It is widely used in the Python community and is the documentation generator for many popular Python projects.
Shibuya -- "Beautiful responsive theme for Sphinx documentation generator. Great supports for Jupyter extensions.", as seen here - Advanced Alchemy (a companion library for SQLAlchemy).
Esbonio aids the writing process by resolving references, providing completion suggestions and highlighting errors. It ensures your local build is always up to date, allowing you to preview your changes in (almost!) real-time. The server itself can even be extended to better suit the needs of your project.
The primary goal of Esbonio is to reduce the friction that comes from trying to remember the specifics of a markup language, so that you can focus on your content and not your tooling.
Context Engineering is building dynamic systems to provide the right information and tools in the right format such that the LLM can plausibly accomplish the task.
Should consider Context Engineering as an evolved form of Prompt Engineering.
You can use the exiftool (available on MacOS and other Unixes) to remove GPS information etc from your photos.
$ brew install exiftool
$ exiftool IMG.HEIC
.... prints out a long list of exif information ...
$ exiftool -all= IMG.HEIC
... strips out exif info ..
$ exiftool IMG.HEIC # to confirm reduced exif infor
Original Image with embedded EXIF dataAltered Image with reduced EXIF data
A reranker is often used as a refinement step in a two-stage retrieval system. In the first stage, embedding-based methods (or lexical search algorithms such as BM25 and TF-IDF) produce a broad set of initial search results. Following this, a re-ranker evaluates the relevance scores between the query and the candidate documents and selects the most pertinent subset of candidate documents based on the scores.
Word Embedding Analysis -- provides semantic analysis tools based on high-dimensional vector space word embeddings, combining updated features. You can play around the online tools to see how the different techniques work.
Embedding Atlas is a tool from Apple that provides interactive visualizations for large embeddings. It allows you to visualize, cross-filter, and search embeddings and metadata.
Nice exploration UX with hover and tool tip for single data points. Shows you nearest neighbors, which is cool. Coloring based on metadata for better insights -- via
I've never felt this much behind as a programmer. The profession is being dramatically refactored as the bits contributed by the programmer are increasingly sparse and between. I have a sense that I could be 10X more powerful if I just properly string together what has become available over the last ~year and a failure to claim the boost feels decidedly like skill issue. There's a new programmable layer of abstraction to master (in addition to the usual layers below) involving agents, subagents, their prompts, contexts, memory, modes, permissions, tools, plugins, skills, hooks, MCP, LSP, slash commands, workflows, IDE integrations, and a need to build an all-encompassing mental model for strengths and pitfalls of fundamentally stochastic, fallible, unintelligible and changing entities suddenly intermingled with what used to be good old fashioned engineering. Clearly some powerful alien tool was handed around except it comes with no manual and everyone has to figure out how to hold it and operate it, while the resulting magnitude 9 earthquake is rocking the profession. Roll up your sleeves to not fall behind.
The above appears to be influenced by Claude Opus 4.5 release. Some of the hype around "new layer of abstraction" might be a bit hyped, but there is something to consider about the hype, and see what can be taken away from that.
Claude Code was created by Boris Cherny in Sep 2024.
Droid CLI "Run a real agent session from your terminal. Droid plans, edits, executes tools, streams results, and keeps the approval model visible." From this thread -- Best tools for AImaxing
OpenCode is an open source agent that helps you write code in your terminal, IDE, or desktop.
Toad is a unified experience for AI in the terminal for AI tools such as OpenHands, Claude Code, Gemini CLI, and many more. All of which run seamlessly under a single terminal UI, thanks to the ACP protocol.
Factory.AI an AI-native software development platform that works everywhere you do. From IDE to CI/CD - delegate complete tasks like refactors, incident response, and migrations to Droids without changing your tools, models, or workflow.
CodeBoarding "Helping teams visualize, scale, and collaborate across complex codebases. CodeBoarding transforms complex codebases into clear, visual maps — across every level of abstraction."