Skip to content

Instantly share code, notes, and snippets.

View sailist's full-sized avatar
🏠
Working from home

Haozhe sailist

🏠
Working from home
  • Sophgo
View GitHub Profile
@sailist
sailist / DBScan.py
Last active May 7, 2019 04:52
DBScan algorithm implement and detail commented
from sklearn.datasets import make_blobs
from matplotlib import pyplot as plt
import numpy as np
def distance(ix, iy):
return np.linalg.norm(x_map[ix] - x_map[iy])
def is_cluster(ix):
return yy[ix] > 0
@sailist
sailist / FP-Grotth.js
Created May 5, 2019 08:18
Quick set value in the table
// 可视化网站 链接http://athena.ecs.csus.edu/~associationcw/FpGrowth.html
// 对于一些数据可能会出错误
var align = [["A",1,],
["B",2,],
["C",3,],
["D",4,],
["E",5,],
["F",6,],
["G",7,],
@sailist
sailist / BUC.py
Last active September 23, 2022 18:55
BUC algorithm
import pandas as pd
import random
A = ["a1","a2","a3","a4"]
B = ["b1","b2","b3","b4"]
C = ["c1","c2","c3","c4"]
D = ["d1","d2"]
ALL = [A,B,C,D]
def sample(size = 6):
li = []
@sailist
sailist / run.js
Last active May 27, 2019 03:34
本科生教学评估
ele = $('tbody tr input');
index = 0;
value = [0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,
1,1,2,0];
txt = "老师教的很好";
@sailist
sailist / pinyin2alpha.txt
Created June 2, 2019 06:50
将拼音的声调转换为字母+数字的形式
ū#u,1
à#a,4
ǔ#u,3
ǐ#i,3
í#i,2
é#e,2
ó#o,4
ò#o,2
ā#a,1
ú#u,2
@sailist
sailist / muti_gpu.py
Created June 19, 2019 14:05
使用多张GPU同时训练,存储自https://www.jianshu.com/p/db0ba022936f
class ParallelModel(keras.models.Model):
"""Subclasses the standard Keras Model and adds multi-GPU support.
It works by creating a copy of the model on each GPU. Then it slices
the inputs and sends a slice to each copy of the model, and then
merges the outputs together and applies the loss on the combined
outputs.
"""
def __init__(self, keras_model, gpu_count):
"""Class constructor.
@sailist
sailist / mel_feature.py
Created June 21, 2019 06:36
用于机器学习的MFCC特征提取方法,提供了对单个音频的特征提取和batch级的音频的特征提取
from keras.layers import Layer
import numpy as np
from keras.layers import Lambda
from librosa.feature import melspectrogram
from keras import backend as K
from keras.preprocessing.sequence import pad_sequences
from sklearn.preprocessing import scale as skscale
from scipy import signal
class MelFeature():
@sailist
sailist / build.cmd
Created August 1, 2019 02:56
quick_build_pip_templet
python setup.py sdist bdist_wheel
SET CountI=0
SET BakDir="./dist/"
for /f %%a in ('dir %BakDir% /a:-d /B /o:-D') do (
rem echo %%a
SET FileName=%%a
SET CountI=CountI+1
rem echo %CountI%
if %CountI% == 0 goto bakup2
@sailist
sailist / regeist.reg
Created August 3, 2019 05:51
右键新建菜单中新增 .md 文件的写法:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.md\ShellNew]
"NullFile"=""
"FileName"="template.md"
@sailist
sailist / gitautopush
Created August 9, 2019 09:47
git 快速提交脚本
set /p commitmsg=input commitmsg:
git add *
git commit -m %a%
git push