Skip to content

Instantly share code, notes, and snippets.

View florisdenhengst's full-sized avatar

Floris den Hengst florisdenhengst

View GitHub Profile
import gym
class Environment(gym.env):
state = {}
def __init__(self):
self.state['motivation'] = -1
self.state['glucose'] = 60
self.state['went_to_gym'] = 0
self.state['age_in_years'] = 31
import scipy
import numpy as np
def bootstrap_ci(xs, conf=.95, n=9999, seed=0):
"""
Computes a confidence interval of the mean for a given input of scalar values xs, a confidence level (defaults to .95),
a number of iterations (defaults to 9999).
Uses a fixed random seed for reproducibility.
@florisdenhengst
florisdenhengst / mapiecp.py
Last active June 14, 2023 17:52
Using MAPIE for conformal prediction including some analysis
import matplotlib.pyplot as plt
import numpy as np
from typing import cast, Callable
from numpy.typing import ArrayLike, NDArray
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from sklearn.utils.validation import column_or_1d, check_array
import seaborn as sns
from mapie.classification import MapieClassifier
from mapie.metrics import (
@florisdenhengst
florisdenhengst / clean_pacman_cache.sh
Last active June 15, 2017 16:18
Interactive script for cleaning pacman (Arch) cache
#! /bin/bash
stopping=0
function promptRemovePackage {
package=$1
# TODO: print man page extract (name/synopsis only)
read -p "Recursively remove $1? (y/n/q) " myvar
case "$myvar" in
y|Y )
@florisdenhengst
florisdenhengst / queued_signals_test.c
Last active August 29, 2015 14:20
Example of using natively queued signals in C using a signal mask, sigaction and real time signals
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
/* Required nr of command line arguments*/
#define REQ_ARGS 2