Skip to content

Instantly share code, notes, and snippets.

View RomanSteinberg's full-sized avatar

Roman Steinberg RomanSteinberg

  • Vision Systems
  • Rostov-on-Don
View GitHub Profile
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
@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
@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 / 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 / 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 / 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 / start.py
Created July 6, 2018 15:04
start_queue_runners
import tensorflow as tf
from glob import glob
folder = './data/*.jpg'
def create_graph():
filename_queue = tf.train.string_input_producer(list(glob(folder)))
reader = tf.TextLineReader()
key, value = reader.read(filename_queue)
@RomanSteinberg
RomanSteinberg / preproc.py
Created July 9, 2018 13:47
preprocessing
import tensorflow as tf
from imageio import imsave, imread
def read_and_preproc():
inp_img_op = tf.placeholder(tf.float32, shape=[None, None, 3])
image_size_before_crop, IMG_HEIGHT, IMG_WIDTH = 286, 256, 256
# Preprocessing:
out = tf.image.resize_images(inp_img_op, [image_size_before_crop, image_size_before_crop])
out = tf.random_crop(out, [IMG_HEIGHT, IMG_WIDTH, 3])
@RomanSteinberg
RomanSteinberg / sol
Created July 13, 2018 08:11
solution
function fk(n) {
return (n*(n + 1)) / 2;
}
var data = readline().split(' ').map(function(x) { return parseInt(x); });
var n = data[0];
var m = data[1];
var k = data[2];
var nL = k - 1;
@RomanSteinberg
RomanSteinberg / task.js
Created July 18, 2018 15:51
models/task.js
const Promise = require('bluebird');
const mongoose = require('mongoose');
const _ = require('lodash');
const Answer = require('./answer');
const GooGl = require('./goo-gl');
const Meta = require('./meta');
const Recommendations = require('./recommendations');
const config = require('../config');