Skip to content

Instantly share code, notes, and snippets.

View subpath's full-sized avatar
🇩🇪

Alexander Osipenko subpath

🇩🇪
View GitHub Profile
@subpath
subpath / Gale-Shapley.ipynb
Last active November 16, 2023 22:07
Gale-Shapley algorithm
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@subpath
subpath / bad_idea.py
Created April 1, 2019 17:21
how to read pcap file in a slow way
from scapy.all import *
from tqdm import tqdm
import pandas as pd
raw = rdpcap(mypcap.pcap)
ip_data = []
tcp_data = []
for frame in tqdm(raw, desc='Converting'):
if 'options' in frame['IP'].fields: del frame['IP'].fields['options']
"""Read pdf files and extract tabular data."""
from tabula import read_pdf
def file_to_dataframe(file_path):
"""Read and save tables from pdf."""
tables = read_pdf(file_path, multiple_tables=True)
# extract and format potency table
potency_table = tables[0]
potency_table = potency_table.drop(potency_table.index[[0, 1]])
"""Save pdf files from lab website."""
from bs4 import BeautifulSoup
from bs4.dammit import EncodingDetector
import requests
from tqdm import tqdm
# connect to the webpage
url = 'https://forwardgro.com/testresults/'
resp = requests.get(url)
@subpath
subpath / Monty_Hall_simulation.ipynb
Last active May 23, 2020 13:05
Monty Hall simulation
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@subpath
subpath / Extracting_best_hyperparameters_from_TPOT.ipynb
Last active November 14, 2019 21:09
How to extract best parameters from TPOT
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@subpath
subpath / tSNE_and_word2vec_visualization.ipynb
Created August 15, 2018 11:05
Visualization of word similarity with t-SNE and word2vec
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@subpath
subpath / SimpleGAN.py
Created August 14, 2018 06:22
Simple GAN with Keras
import numpy as np
from keras.datasets import mnist
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization
from keras.layers.advanced_activations import LeakyReLU
from keras.models import Sequential
from keras.optimizers import Adam
from logger import logger
import matplotlib.pyplot as plt
@subpath
subpath / Custom_backtest_for_time_series.py
Created August 9, 2018 15:46
Custom backtest for Time Series model validation
import numpy as np
import pandas as pd
import requests
from sklearn.linear_model import BayesianRidge
#load market data
market_data = get_market_data('BTC/USD')
#shift target variable one day back
#in order to train model to predict one day into future