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
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" integrity="sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==" crossorigin="anonymous"></script> | |
<title>{%block title%}{%endblock%}</title> | |
<style type="text/css"> | |
li { | |
color: black; | |
background-color: white; | |
} |
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
# Data from https://github.com/dkobak/elections/blob/master/electionsData.zip | |
import seaborn as sns | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import numpy as np | |
df = pd.read_csv('2018.txt', sep='\t') | |
################################## | |
keys = list(df.keys()) |
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 hashlib | |
import random | |
from bottle import get, post, run, template, request, response | |
def valid_session_id(session_id): | |
return len(session_id) == 32 | |
def generate_session_id(): | |
chars = [chr(ord('a')+i) for i in range(26)] + [str(i) for i in range(10)] | |
return ''.join([random.choice(chars) for _ in range(32)]) |
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 plotly.offline as py | |
import plotly.graph_objs as go | |
py.init_notebook_mode() | |
x = [8,10,6] | |
y = ['Kenya', 'Kosovo', 'Nigeria'] | |
y_enum = list(range(len(y))) | |
worst_score, best_score = 7, 20 | |
overhang = 0.25 |
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 random | |
state = 'start' | |
# можем передать вероятности | |
# random_choice({'a_little': 0.1, 'y_big': 0.3, 'y_little': 0.4, 'finish': 0.2}) | |
# или любые доли - лишь бы неотрицательные | |
# random_choice({'a_little': 2, 'y_big': 6, 'y_little': 8, 'finish': 4}) | |
def random_choice(variants): | |
# случайное число от 0 до суммы всех долей. | |
random_value = random.random() * sum(variants.values()) | |
# накапливаем долю интервала, покрытую уже рассмотренными вариантами |
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 random | |
state = 'start' | |
# можем передать вероятности | |
# random_choice({'a_little': 0.1, 'y_big': 0.3, 'y_little': 0.4, 'finish': 0.2}) | |
# или любые доли - лишь бы неотрицательные | |
# random_choice({'a_little': 2, 'y_big': 6, 'y_little': 8, 'finish': 4}) | |
def random_choice(variants): | |
# случайное число от 0 до суммы всех долей. | |
random_value = random.random() * sum(variants.values()) | |
# накапливаем долю интервала, покрытую уже рассмотренными вариантами |
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 random | |
state = 'start' | |
Tram = 0.5 | |
param = 0.5 | |
pa = 3/8 | |
pam = 5/8 | |
Trym = 2/7 | |
Tyrym = 5/7 | |
pym = 1 |
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 | |
testfile=`realpath $1` | |
FEATURE=`echo $1 | xargs basename | sed -re 's/\.test\.tsv$//'` | |
CL=`echo $FEATURE | sed -re 's/^([^.]+)\..+$/\1/'` | |
if [ "$CL" == "all" ]; then | |
DIRNAME=`echo $1 | xargs dirname | xargs --replace echo {}/.. | xargs realpath` | |
train_file="${DIRNAME}/train/${FEATURE}.train.tsv" | |
fit_file="${DIRNAME}/fit_chr_not2_9_22/${FEATURE}.fit_chr_not2_9_22.tsv" | |
validation_file="${DIRNAME}/val_chr_2_9_22/${FEATURE}.val_chr_2_9_22.tsv" |
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 check_sum(xs_head_sum, xs_tail, goal_sum, equation_head): | |
if len(xs_tail) == 0: | |
if xs_head_sum == goal_sum: | |
return '{}={}'.format(equation_head, goal_sum) | |
else: | |
return None | |
result_1 = check_sum(xs_head_sum + xs_tail[0], xs_tail[1:], goal_sum, '{}+{}'.format(equation_head, xs_tail[0])) | |
if result_1: | |
return result_1 | |
result_2 = check_sum(xs_head_sum - xs_tail[0], xs_tail[1:], goal_sum, '{}-{}'.format(equation_head, xs_tail[0])) |
NewerOlder