Install the OpenSSL on Debian based systems
sudo apt-get install openssl
# Python implementation of the EXP3 (Exponential weight for Exploration and Exploitation) | |
# algorithm for solving adversarial bandit problems. Based on the original paper: | |
# http://rob.schapire.net/papers/AuerCeFrSc01.pdf | |
import numpy as np | |
import time | |
np.random.seed(12345) | |
n_arms = 4 |
import math | |
import types | |
from pandas.api.types import is_string_dtype | |
from pandas.api.types import is_numeric_dtype | |
from tqdm import tqdm | |
def df_to_vw_regression(df, filepath='in.txt', sample_weights=None, columns=None, target=None, namespace='namespace'): | |
if columns is None: | |
columns = df.columns.tolist() |
import torch | |
# Original author: Francisco Massa: | |
# https://github.com/fmassa/object-detection.torch | |
# Ported to PyTorch by Max deGroot (02/01/2017) | |
def nms(boxes, scores, overlap=0.5, top_k=200): | |
"""Apply non-maximum suppression at test time to avoid detecting too many | |
overlapping bounding boxes for a given object. | |
Args: | |
boxes: (tensor) The location preds for the img, Shape: [num_priors,4]. |
Reference - https://www.eriksmistad.no/getting-started-with-google-test-on-ubuntu/
sudo apt-get install libgtest-dev
sudo apt-get install cmake # install cmake
cd /usr/src/gtest
sudo cmake CMakeLists.txt
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# https://toster.ru/q/72866 | |
# How to | |
# wget http://gist.github.com/... | |
# chmod +x ya.py | |
# ./ya.py download_url path/to/directory | |
import os, sys, json |
def conv2d_bn(x, filters, kernel_size, strides=1, padding='same', activation='relu', use_bias=False, name=None): | |
x = Conv2D(filters, kernel_size, strides=strides, padding=padding, use_bias=use_bias, kernel_initializer='he_normal', name=name)(x) | |
if not use_bias: | |
bn_axis = 1 if K.image_data_format() == 'channels_first' else 3 | |
bn_name = None if name is None else name + '_bn' | |
x = BatchNormalization(axis=bn_axis, scale=False, name=bn_name)(x) | |
return x | |
def mfm(x): | |
shape = K.int_shape(x) |