Skip to content

Instantly share code, notes, and snippets.

View Anaphory's full-sized avatar

Gereon Kaiping Anaphory

  • DB Netz
  • München area
View GitHub Profile
import typing
from collections import Counter
import numpy
def match_pixels(
prediction: numpy.ndarray, ground_truth: numpy.ndarray
) -> (typing.Mapping, int):
"""Compare two rasters and calculate the deviation under good matching.
@Anaphory
Anaphory / sinotibetan.xml
Created July 6, 2021 12:41
Sinotibetan Phylogeny Configuration
<?xml version='1.0' encoding='UTF-8'?>
<beast namespace="beast.math.distributions:beast.core:beast.evolution.operators:beast.evolution.alignment:beast.evolution.substitutionmodel" version="2.6">
<data id="vocabulary" dataType="integer" spec="Alignment">
<sequence id="language_data_vocabulary:Burmish_Achang" taxon="Burmish_Achang" value="0??????????????????????????????????????????0000000000000000001000000000000000010000000001000001000000000000001000000000000000000000000001000000000000000000001000000000001000000000000000001000000000000000001000000000000000010000000000000000000100000000000000000000000000000100000000000000000000010000000000000000000000010000000000000000000000000000000001000000001000000000000010000000000000000010000000000000000000000100000000000000000000000000000001000000000000000010000000000000000000000000100000000000000100000000001000000000000000000000000000000000000000000000000000000100000000000000000001000000000000000000000000000000000010000000000100000000000000000?????000000000000000000
@Anaphory
Anaphory / keybase.md
Created March 23, 2021 12:47
keybase.md

Keybase proof

I hereby claim:

  • I am anaphory on github.
  • I am anaphory (https://keybase.io/anaphory) on keybase.
  • I have a public key ASCVWgVP2NiRqAl2iERc5hBOnrdfNTWdmc9PwR5FrwGnwQo

To claim this, I am signing this object:

@Anaphory
Anaphory / generate_sentences_with_morphology.py
Created March 2, 2021 13:46
Small Python script to generate simple sentences for a synthetic language with minimal concatenative morphology
import random
import bisect
from collections import Counter
class DiscreteProbabilities:
def __init__(self, ps):
keys, values = zip(*sorted(ps.items(), key=lambda kv: kv[1], reverse=True))
self.values = numpy.cumsum(values)
self.values /= self.values[-1]
@Anaphory
Anaphory / transcription.log
Created August 27, 2018 11:26
Running anaphory/learn_self_prediction.py
$ ipython -i learn_self_prediction.py
Python 3.7.0 (default, Jul 15 2018, 10:44:58)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.
2018-08-24 13:25:17.004949: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
0
6334.686 6314.654 6454.043 5467.191 4630.695 5274.8535 4090.4727 5082.1665 4502.7056 4170.152 3758.1313 3549.1992 5426.775 4515.8086 4039.757 4290.015 4046.6309 3355.1636 3481.4727 4011.1167 4178.433 3500.3604 4051.9387 3624.7375 3237.043 3290.1333 2853.6572 3310.5354 4224.2935 3168.8103 1848.3478 3250.229 3800.9048 2348.2676 3272.28 2983.5427 3413.0337 3097.3425 2112.8743 3239.0488 3507.999 2810.7412 3342.6511 3041.751 3207.8457 3690.589 3361.581 3579.3613 4382.718 3158.9675 2267.3567 3017.4578 3500.6853 3729.4807 3245.2744 2825.9363 2228.9045 3072.2527 2228.2583 2793.7139 2314.4797 3250.0674 3723.1445 217
#!/usr/bin/env python
"""Script to plot trees with ASR using ete3."""
import argparse
import sys
import pandas
import ete3
@Anaphory
Anaphory / 1d6d6d6.py
Created January 15, 2014 23:25
Calculations for non-associativity of dice
#!/usr/bin/env python3
import collections
class DiscreteProbabilityDistribution:
def __init__(self, pdict):
try:
self.pdict = collections.Counter(pdict)
except:
self.pdict = collections.Counter({pdict: 1})