Skip to content

Instantly share code, notes, and snippets.

View thierrymoudiki's full-sized avatar

Thierry Moudiki thierrymoudiki

View GitHub Profile
@thierrymoudiki
thierrymoudiki / figures.tex
Created January 12, 2026 04:00
figures in LaTeX
\begin{figure}[ht]
\centering
\includegraphics[width=0.9\textwidth]{figure5_model_comparison_summary.pdf}
\caption{Comprehensive model comparison...}
\end{figure}
@thierrymoudiki
thierrymoudiki / gist:1894dffe30a83cb1be9537e9ec6b5b22
Created January 10, 2026 12:52
generate the SHA256 hash for conda pkg
curl -sL https://github.com/owner/repo/archive/refs/tags/vX.X.X.tar.gz | openssl sha256
@thierrymoudiki
thierrymoudiki / code.R
Created January 8, 2026 09:54
formulas vs matrix interface
#' Convert formula-based model function to matrix interface
#'
#' @param fit_func Function accepting formula and data
#' @param predict_func Optional prediction function
#' @param intercept Include intercept in formula (default TRUE)
#' @return List with fit and predict methods
formula_to_matrix <- function(fit_func, predict_func = NULL, intercept = TRUE) {
fit_wrapper <- function(X, y, ...) {
# Input validation
@thierrymoudiki
thierrymoudiki / bayesopt.R
Last active January 21, 2026 14:59
Bayesian optimization using bayesianrvfl::bayes_opt
# Run Bayesian optimization minimizing rmse
remotes::install_github("thierrymoudiki/bayesianrvfl")
> head(bayesianrvfl::bayes_opt)
# function (objective, lower, upper, type_acq = c("ei", "ucb"),
# nb_init = 10L, nb_iter = 90L, kappa = 1.96, method = c("standard",
# "direct_online", "polyak_online"), surrogate_model = c("rvfl",
# "matern52", "rvfl_emcee", "rf"), optim_surr = c("GCV",
@thierrymoudiki
thierrymoudiki / loop_sklearn_models.py
Last active December 13, 2025 18:27
Loop on all sklearn models
from sklearn.utils import all_estimators
from tqdm import tqdm
# Get all scikit-learn regressors
estimators = all_estimators(type_filter='regressor')
for name, RegressorClass in tqdm(estimators):
if name in ['MultiOutputRegressor', 'MultiOutputClassifier', 'StackingRegressor', 'StackingClassifier',
@thierrymoudiki
thierrymoudiki / doSNOW.R
Created October 3, 2025 07:31 — forked from andrie/doSNOW.R
Progress bars with foreach and doSNOW
library(doSNOW)
library(tcltk)
cl <- makeSOCKcluster(2)
registerDoSNOW(cl)
pb <- txtProgressBar(max=100, style=3)
progress <- function(n) setTxtProgressBar(pb, n)
opts <- list(progress=progress)
r <- foreach(i=1:100, .options.snow=opts) %dopar% {
#!/bin/bash
# first, install jq: on macOS, brew install jq
wget https://raw.githubusercontent.com/Techtonique/datasets/refs/heads/main/tabular/survival/gbsg2_2.csv
# === CONFIG ===
JSON_FILE="survival_curves.json"
CSV_FILE="survival_curves.csv"
PLOT_FILE="survival_plot.png"
#!/bin/bash
# === CONFIG ===
OUTPUT_JSON="sims.json"
OUTPUT_CSV="sims.csv"
OUTPUT_IMAGE="plot.png"
# === 1. Prompt for Bearer token ===
read -p "Enter your Bearer token: " AUTH_TOKEN
@thierrymoudiki
thierrymoudiki / Makefile
Last active October 27, 2024 07:09
Makefile for working with Rmd and Rnw scripts
.PHONY: clean getwd initialize help render-rnw render-rmd setwd
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import os, webbrowser, sys
from urllib.request import pathname2url
# The input is expected to be the full HTML filename
filename = sys.argv[1]
filepath = os.path.abspath(os.path.join(filename))