Skip to content

Instantly share code, notes, and snippets.

View RomanSteinberg's full-sized avatar

Roman Steinberg RomanSteinberg

View GitHub Profile
@RomanSteinberg
RomanSteinberg / img_helpers.py
Last active May 28, 2018 14:40
CPU and GPU Tensorflow comparisons
# -*- coding: utf-8 -*-
import numpy as np
from glob import glob
import tensorflow.contrib.keras as K
from skimage.util import view_as_windows, pad
resnet = K.applications.resnet50
image = K.preprocessing.image
@RomanSteinberg
RomanSteinberg / gpu_check.py
Last active January 18, 2018 14:37
gpu_check
def gpu_check():
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '/device/gpu:0'
import tensorflow as tf
from datetime import datetime
shape = (10, 10)
device_name = "/gpu:0"
with tf.device(device_name):
@RomanSteinberg
RomanSteinberg / vae.py
Created December 20, 2017 11:40
VAE (MNIST)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# import tensorflow as tf
import tensorflow as tf, numpy as np
from tensorflow import nn
from tensorflow import keras as ke
from tensorflow.examples.tutorials.mnist import input_data
@RomanSteinberg
RomanSteinberg / install-nvidia.md
Created November 14, 2017 09:35
Install nvidia staff

Introduction

I assume you make clean system install, no previous Nvidia installations. Other case, try the following steps on your own risk:

  • sudo apt-get purge 'nvidia*'
  • rm ~/.Xauthority

Pre-step

Switch off the PC, remove video card

@RomanSteinberg
RomanSteinberg / results.txt
Last active October 30, 2017 15:52
RMSE in catboost 0.2.5
Borders for float features generated
0: learn 70.50475406 test 40.44999897 bestTest 40.44999897 total: 47.1ms remaining: 424ms
1: learn 65.63694777 test 53.45852055 bestTest 40.44999897 total: 47.6ms remaining: 191ms
2: learn 57.7842572 test 100.5151111 bestTest 40.44999897 total: 48.1ms remaining: 112ms
3: learn 55.30496775 test 128.7490654 bestTest 40.44999897 total: 48.6ms remaining: 72.8ms
4: learn 52.89929452 test 136.0044652 bestTest 40.44999897 total: 49ms remaining: 49ms
5: learn 51.9437037 test 150.0426779 bestTest 40.44999897 total: 49.6ms remaining: 33ms
6: learn 51.70084336 test 158.4656055 bestTest 40.44999897 total: 50.1ms remaining: 21.5ms
7: learn 50.61418096 test 162.2118236 bestTest 40.44999897 total: 50.6ms remaining: 12.6ms
8: learn 50.49985141 test 165.7670929 bestTest 40.44999897 total: 51.1ms remaining: 5.67ms
import numpy as np
import pandas as pd
import scipy.stats as ss
import scipy
def get_bootstrap_samples(data, n_samples):
indices = np.random.randint(0, len(data), (n_samples, len(data)))
samples = data[indices]
return samples