Skip to content

Instantly share code, notes, and snippets.

View tommylees112's full-sized avatar
🐘

Tommy Lees tommylees112

🐘
  • University of Oxford
  • Oxford
View GitHub Profile
@tommylees112
tommylees112 / unpooled_stan_model.py
Created December 21, 2021 23:23
Unpooled Stan Model with dummy data for SO Question / Stan Forum Question
import pandas as pd
import numpy as np
from cmdstanpy import cmdstan_path, CmdStanModel, CmdStanMCMC
def make_dummy_data():
variables = [f"SM_lag_{i}" for i in range(6)]
variables += [f"PCP_lag_{i}" for i in range(6)]
variables += [f"VCI_lag_{i}" for i in range(6)]
N_samples = 100
conda create -n cmdstanpy --yes
conda activate cmdstanpy
conda install -c conda-forge arviz matplotlib seaborn jupyterlab ipython pip ruamel.yaml netcdf4 statsmodels scikit-learn black mypy --yes
pip install cmdstanpy
conda create -n pystan --yes
conda activate pystan
conda install -c conda-forge pystan --yes
conda install -c conda-forge arviz matplotlib seaborn jupyterlab ipython pip ruamel.yaml netcdf4 statsmodels scikit-learn black mypy --yes
@tommylees112
tommylees112 / pymc_env.sh
Last active December 21, 2021 12:36
Environment for working with PyMC 3.11.2
conda create -n pymc --yes
conda activate pymc
conda install -c conda-forge pymc3=3.11.2 --yes
conda install -c conda-forge jax arviz numpyro matplotlib seaborn jupyterlab ipython pip ruamel.yaml netcdf4 statsmodels scikit-learn black mypy --yes
conda create -n prophet --yes
conda activate prophet
conda install -c conda-forge prophet ipython jupyterlab seaborn --yes
conda install -c conda-forge netcdf4 numba tqdm ipython pip ruamel.yaml xarray descartes statsmodels scikit-learn black mypy eofs xskillscore cdsapi cftime --yes

FIX BY BUILDING AN UBUNTU MACHINE! (not debian the default)

ERROR: Unable to load the kernel module 'nvidia.ko'.  This happens most frequently when this kernel module was built against the wrong or improperly configured kernel sources, with a version of gcc that differs from the one used to build the target kernel, or if another driver, such as nouveau, is present and prevents the NVIDIA kernel module from obtaining ownership of the NVIDIA device(s), or no NVIDIA device installed in this system is supported by this NVIDIA Linux graphics driver release.
@tommylees112
tommylees112 / setup.sh
Last active November 19, 2021 11:22
processes when setting up new GCLOUD option
# Make sure it's an ubuntu distribution
# or just use one of the pre-made nvidia machines: https://cloud.google.com/deep-learning-vm/docs/pytorch_start_instance
sudo apt-get install wget
sudo apt-get install tmux
# Generate SSH keys
# copy the .pub file into ~/.ssh/authorized_keys ON THE REMOTE MACHINE
# https://superuser.com/questions/421004/how-to-fix-warning-about-ecdsa-host-key
# remove the cached key '' $ ssh-keygen -R
# wget miniconda installer from here:
conda create -n srtm --yes
conda activate srtm
conda install -c conda-forge gdal elevation --yes
conda install -c conda-forge netcdf4 xarray ipython six scipy scikit-learn seaborn matplotlib --yes
pip install elevation
conda create -n keras --yes
conda activate keras
conda install -c conda-forge keras tensorflow --yes
# conda install pytorch torchvision -c pytorch --yes
# conda install -c conda-forge seaborn=0.11 --yes3
# conda install -c conda-forge jupyterlab=3.0.16 --yes
conda install -c conda-forge jupyterlab seaborn --yes
conda install -c conda-forge netcdf4 numba tqdm tensorboard ipython pip ruamel.yaml xarray descartes statsmodels scikit-learn black mypy eofs xskillscore cdsapi --yes
conda install -c conda-forge cartopy pyflwdir --yes
conda install -c conda-forge pytest pytest-cov --yes
conda create -n kf python=3.9
conda activate kf
conda install -c conda-forge filterpy pandas matplotlib numpy seaborn ipython jupyterlab sklearn black mypy --yes
conda install -c anaconda ipywidgets --yes