Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
"""
Created on Tue Nov 24 12:57:55 2020
@author: tlinden
elastic net penalized cox regression
with (dummy coding) and standardization
stacked in a sklearn pipeline
tuned with bayesian hyperparamter optimization
@thomasmooon
thomasmooon / .bash_profile
Last active January 9, 2020 07:18
.bashrc file conda
# in order to load the .bashrc by default, it must be in the `.bash_profile`
# https://askubuntu.com/questions/161249/bashrc-not-executed-when-opening-new-terminal
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
@thomasmooon
thomasmooon / readme.txt
Created April 25, 2019 08:11
test SHAP package
see https://www.meistertask.com/app/task/29UR1Jpo/shap-keras-tf-test-package
@thomasmooon
thomasmooon / tf_keras_multiGPU.py
Created January 28, 2019 15:39
keras tensorflow multi GPU assigment and limitation of GPU and GPU-memory usage
def gpu_assignment(gpus, allow_growth = True, per_process_gpu_memory_fraction = 0.95):
# GPU assignment
######################################################
# !! run this BEFORE importing TF or keras !!
# run code only on a single, particular GPU
# from http://kawahara.ca/select-single-gpu-keras/
######################################################
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
@thomasmooon
thomasmooon / memlog.sh
Created November 26, 2018 08:46
linux memory log
#!/bin/bash -e
echo " date time $(free -m | grep total | sed -E 's/^ (.*)/\1/g')"
while true; do
echo "$(date '+%Y-%m-%d %H:%M:%S') $(free -m | grep Mem: | sed 's/Mem://g')"
sleep 1
done
@thomasmooon
thomasmooon / example_trials_visualization.ipynb
Last active November 9, 2018 14:10
hyperopt save and reload trials object
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thomasmooon
thomasmooon / tensorflow_self_check.py
Created October 15, 2018 15:09 — forked from mrry/tensorflow_self_check.py
[DEPRECATED] TensorFlow on Windows self-check
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@thomasmooon
thomasmooon / ec2-cuda-setup.bash
Created September 21, 2018 16:44 — forked from avtomaton/ec2-cuda-setup.bash
amazon AMI CUDA setup
#!/bin/bash
NVIDIA_DRIVER_VERSION=352.63
NVIDIA_CUDA_VERSION=7.5
NVIDIA_CUDA_FULL_VERSION=7.5.18
sudo yum update -y
sudo yum groupinstall -y "Development tools"
sudo yum install kernel-devel-`uname -r`
@thomasmooon
thomasmooon / stopwatch.py
Created July 10, 2018 12:39 — forked from igniteflow/stopwatch.py
A simple stopwatch implemented in Python
import datetime
class Timer(object):
"""A simple timer class"""
def __init__(self):
pass
def start(self):
"""Starts the timer"""
from keras.models import Sequential
from keras.layers import Dense
from keras.utils.io_utils import HDF5Matrix
import numpy as np
def create_dataset():
import h5py
X = np.random.randn(200,10).astype('float32')
y = np.random.randint(0, 2, size=(200,1))
f = h5py.File('test.h5', 'w')