Skip to content

Instantly share code, notes, and snippets.

View KDercksen's full-sized avatar

Koen Dercksen KDercksen

View GitHub Profile
@alexklibisz
alexklibisz / weighted_log_loss.py
Created April 11, 2017 20:30
Keras weighted log loss
def weighted_log_loss(yt, yp):
'''Log loss that weights false positives or false negatives more.
Punish the false negatives if you care about making sure all the neurons
are found and don't mind some false positives. Vice versa for punishing
the false positives. Concept taken from the UNet paper where they
weighted boundary errors to get cleaner boundaries.'''
emphasis = 'fn'
assert emphasis in ['fn', 'fp']
m = 2
@thatguysimon
thatguysimon / standoff2corenlp.py
Last active October 4, 2023 12:04
A python script to convert annotated data in standoff format (brat annotation tool) to the formats expected by Stanford NER and Relation Extractor models
# A python script to turn annotated data in standoff format (brat annotation tool) to the formats expected by Stanford NER and Relation Extractor models
# - NER format based on: http://nlp.stanford.edu/software/crf-faq.html#a
# - RE format based on: http://nlp.stanford.edu/software/relationExtractor.html#training
# Usage:
# 1) Install the pycorenlp package
# 2) Run CoreNLP server (change CORENLP_SERVER_ADDRESS if needed)
# 3) Place .ann and .txt files from brat in the location specified in DATA_DIRECTORY
# 4) Run this script
@shiona
shiona / .asoundrc
Last active March 26, 2024 12:48
Focusrite saffire 6 USB config for linux
pcm.frontroute {
type route
slave.pcm "dmix:USB"
ttable.0.0 1
ttable.1.1 1
}
pcm.frontusb {
type plug
slave.pcm "frontroute"
hint {
i
me
my
myself
we
our
ours
ourselves
you
your