Skip to content

Instantly share code, notes, and snippets.

View tschm's full-sized avatar
🦧
Be sure to wear some flowers in your hair

Thomas Schmelzer tschm

🦧
Be sure to wear some flowers in your hair
View GitHub Profile
@tschm
tschm / jupyter.py
Created February 7, 2019 08:58
Send production scripts to Jupyter
#!/usr/bin/env python3
import os
import nbformat as nbf
from config.config import logger
from pyutil.parent import Production
from pyutil.sql.interfaces.symbols.strategy import Strategy
from pyutil.sql.session import session
FROM rocker/rstudio:3.6.1
# see https://arrow.apache.org/install/
# rocker/rstudio is based on debian
RUN apt update && \
apt install -y -V apt-transport-https curl gnupg lsb-release apt-utils
RUN echo "deb http://deb.debian.org/debian $(lsb_release --codename --short)-backports main contrib" >> /etc/apt/sources.list.d/backports.list && \
curl --output /usr/share/keyrings/apache-arrow-keyring.gpg https://dl.bintray.com/apache/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-keyring.gpg && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/apache-arrow-keyring.gpg] https://dl.bintray.com/apache/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/ $(lsb_release --codename --short) main" >> /etc/apt/sources.list.d/apache-arrow.list && \
@tschm
tschm / f1.py
Created March 9, 2020 10:36
f1 Precision and Recall
def f1(precision, recall):
return 2*(precision*recall)/(precision+recall)
if __name__ == '__main__':
# Matrix for crypto finance
TP = 70 # on how many days did you correctly predict the market goes up?
FP = 10 # on how many days did you predict the market goes up, but it actually went down?
FN = 8 # on how many days did you predict the market goes down, but it actually went up?
TN = 12 # on how many days did you correctly predict the market goes down?
import time
import numpy as np
import cvxpy as cp
from mosek.fusion import Model, Domain, Expr, ObjectiveSense
def cvx_explicit(cov_factor, residual_var, F, mu, gamma, Lmax):
n, m = F.shape

{{ package }} Code of Conduct

Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.