Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

from typing import Generic, TypeVar | |
import numpy as np | |
from pydantic.fields import ModelField | |
JSON_ENCODERS = { | |
np.ndarray: lambda arr: arr.tolist() | |
} | |
DType = TypeVar('DType') |
#!/usr/bin/env python3 | |
'''2021-03-26: Reverse-engineer by searching for the following terms in features*.js: | |
- bracketMaintenanceMarginRate | |
- cumFastMaintenanceAmount | |
- bracketNotionalFloor | |
- bracketNotionalCap''' | |
# (max) position, maintenance margin, maintenance amount | |
maint_lookup_table = [ |
#!/usr/bin/env python3 | |
from __future__ import annotations | |
import json | |
class CompactJSONEncoder(json.JSONEncoder): | |
"""A JSON Encoder that puts small containers on single lines.""" | |
CONTAINER_TYPES = (list, tuple, dict) |
\documentclass[15pt]{scrartcl} | |
\usepackage[a6paper,left=1cm,right=1cm,top=2cm,bottom=1cm,heightrounded]{geometry} | |
\usepackage[svgnames]{xcolor} | |
\usepackage{pdflscape} | |
\usepackage{setspace} | |
\usepackage[utf8]{inputenc} | |
\usepackage[T1]{fontenc} | |
\usepackage{graphicx} | |
\usepackage{wallpaper} | |
\usepackage[normalem]{ulem} |
""" | |
In jupyter notebook simple logging to console | |
""" | |
import logging | |
import sys | |
logging.basicConfig(stream=sys.stdout, level=logging.INFO) | |
# Test | |
logger = logging.getLogger('LOGGER_NAME') |
This environment is dependent off a common network for docker/git plugin and gitea-server, so for this work fine in closed networks we have to create a custom network before run this composefile.
First create your network:
docker network create gitea-network
""" | |
以下の論文で提案された改良x-means法の実装 | |
クラスター数を自動決定するk-meansアルゴリズムの拡張について | |
http://www.rd.dnc.ac.jp/~tunenori/doc/xmeans_euc.pdf | |
""" | |
import numpy as np | |
from scipy import stats | |
from sklearn.cluster import KMeans |
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)