Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################### | |
## extra imports to set GPU options | |
################################### | |
import tensorflow as tf | |
from keras import backend as k | |
config = tf.ConfigProto() # TensorFlow wizardry | |
config.gpu_options.allow_growth = True # Don't pre-allocate memory; allocate as-needed | |
config.gpu_options.per_process_gpu_memory_fraction = 0.95 # Only allow a total fraction the GPU memory to be allocated | |
k.tensorflow_backend.set_session(tf.Session(config=config)) # Create a session with the above options specified. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Random Survival Forest example" | |
author: "Thomas Gerlach" | |
date: "2018 MAY 22" | |
output: html_notebook | |
--- | |
# Content | |
This script briefly introduces training and prediction of a random survival forest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
class Timer(object): | |
"""A simple timer class""" | |
def __init__(self): | |
pass | |
def start(self): | |
"""Starts the timer""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
OlderNewer