Skip to content

Instantly share code, notes, and snippets.

View enamoria's full-sized avatar
💭
vohox

Kính Phan enamoria

💭
vohox
  • Viet Nam
View GitHub Profile
@enamoria
enamoria / NlpUtils.java
Created October 10, 2019 09:13 — forked from behitek/NlpUtils.java
Chuẩn hóa cách gõ dấu câu về kiểu gõ cũ
/*
Copyright @ nguyenvanhieu.vn
Thằng code java này vẫn giữ được lower/upper case
Code này ngon hơn, check đúng trường hợp cần thêm dấu thì mới thêm
Tuy nhiên code python ở dưới không check nhưng vẫn chưa thấy bugs nào hết :v
*/
package utils;
import java.util.*;
@enamoria
enamoria / frequency_estimator.py
Created August 21, 2019 03:09 — forked from endolith/frequency_estimator.py
Frequency estimation methods in Python
from __future__ import division
from numpy.fft import rfft
from numpy import argmax, mean, diff, log, nonzero
from scipy.signal import blackmanharris, correlate
from time import time
import sys
try:
import soundfile as sf
except ImportError:
from scikits.audiolab import flacread
#WINE with error (OLE error 80040154)
wget http://winetricks.org/winetricks
chmod +x winetricks
winetricks -v vcrun6 winetricks -v msxml4
"""
A weighted version of categorical_crossentropy for keras (2.0.6). This lets you apply a weight to unbalanced classes.
@url: https://gist.github.com/wassname/ce364fddfc8a025bfab4348cf5de852d
@author: wassname
"""
from keras import backend as K
def weighted_categorical_crossentropy(weights):
"""
A weighted version of keras.objectives.categorical_crossentropy