Skip to content

Instantly share code, notes, and snippets.

View drbenvincent's full-sized avatar

Benjamin T. Vincent drbenvincent

View GitHub Profile
@drbenvincent
drbenvincent / local-llm-install-instructions.md
Last active May 18, 2026 09:36
Local LLM install instructions - PyMC Labs retreat 2026

Before The Retreat

If you want to play with local LLMs on the retreat, please install Ollama and download at least one model before you travel. Pulls are still large enough that, if everyone downloads on the venue Wi-Fi in Barcelona, the network will die.

I only have capacity to test this on macOS. If you are using Linux or Windows, please follow the official Ollama installation instructions at https://ollama.com/download.

Install Ollama On macOS

Install Ollama from the terminal:

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@drbenvincent
drbenvincent / battery payback time.ipynb
Created August 3, 2024 08:58
Payback time for house battery
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@drbenvincent
drbenvincent / pymc3_distribution_plotting.ipynb
Last active December 29, 2021 02:42
Plotting univariate distributions in PyMC3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import pymc3 as pm
import numpy as np
import arviz as az
%config InlineBackend.figure_format = 'retina'
# Data from https://twitter.com/tomstafford/status/1456914037195907079?s=20
N = np.array([1258, 280]) # total number of caffiene and non-caffiene drinkers
k = np.array([966, 168]) # total number of those who have favourite mugs
def cohens_h(p):
% Add tooolbox code to path
addpath('~/git-local/darc-experiments-matlab')
% Run the toolbox setup code
env_setup
% Get participant information with GUI
[expt_options] = getHumanExperimentOptions();
plotting_style = 'full';
% Add tooolbox code to path
addpath('~/git-local/darc-experiments-matlab')
% Run the toolbox setup code
env_setup
% Get participant information with GUI
[expt_options] = getHumanExperimentOptions();
plotting_style = 'full';
@drbenvincent
drbenvincent / multiple_groups_row_means.R
Created June 13, 2016 11:13
multiple groups of row means in R
# We have a dataframe with many columns.
# 15 of these columns correspond to responses to questions about hunger.
# They group into 5 subscales (each with 3 questions).
# I want to calculate these subscales (means) as well as an overall score (mean of all).
# This then needs to applied to the control condition (C) and a fasted condition (F) scores
# Once the means are calculated I no longer need the raw scores, so bonus is to automatically remove these columns. Need to retain all other columns in orginal dataframe.
# The code below works just fine, but seems pretty verbose. Is there a more R-like, concise way to do this?
# It seems like a split-apply-combine, but applied to columns rather than rows?
true_mean = 0;
true_sigma = 1;
% likelihood_func = @(x, mean, sigma) normpdf(x, mean, sigma);
% the above function to calcalate in matrix form, for speed
likelihood_func = @(params)...
prod(normpdf(repmat(x,[1 numel(params(1))]),...
repmat(params(1), [1 numel(x)])',...
repmat(params(2),[1 numel(x)])' ), 1);
%% generate data