Skip to content

Instantly share code, notes, and snippets.

View matthew-z's full-sized avatar
⛏️
work work

Z ZH matthew-z

⛏️
work work
View GitHub Profile
@matthew-z
matthew-z / tqdm.ipynb
Created December 7, 2019 19:42
tqdm.pandas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@matthew-z
matthew-z / lstm.py
Last active May 26, 2020 08:11
LSTM error in TF2.0
import typing
import tensorflow as tf
import numpy as np
from tensorflow import keras
from tensorflow.keras.models import Sequential, Model
from tensorflow.keras.layers import Dense, Activation, Dropout, Dot, Flatten
from tensorflow.keras.layers import Layer, Input, Lambda
from tensorflow.keras import backend as K
from tensorflow.keras import layers
@matthew-z
matthew-z / dropout.py
Created October 3, 2019 13:06
DecayingDropoutLayer
"""An implementation of Decaying Dropout Layer."""
import typing
import keras.backend as K
from keras.engine import Layer
class DecayingDropoutLayer(Layer):
"""
Layer that processes dropout with exponential decayed keep rate during
@matthew-z
matthew-z / iris_estimator.py
Created July 8, 2018 12:09
iris_estimator
import pandas as pd
import tensorflow as tf
from sklearn import datasets
from tensorflow.contrib.estimator import InMemoryEvaluatorHook
def input_fn(df, batch_size, train=True):
dataset = tf.data.Dataset.from_tensor_slices((df.as_matrix(), df.target.as_matrix().astype("int")))
if train:
import re
def process_raw_words(words, endtag='-'):
'''把单词分割成最小的符号,并且加上结尾符号'''
vocabs = {}
for word, count in words.items():
# 加上空格
word = re.sub(r'([a-zA-Z])', r' \1', word)
word += ' ' + endtag
vocabs[word] = count
return vocabs
default 17:59:37.265602 +0900 Bilibili [Downloader] init
default 17:59:37.268242 +0900 Bilibili [Downloader] video name 骑士&魔法 : 第8话 Secret&Quest 番剧 bilibili 哔哩哔哩弹幕视频网
default 17:59:37.268347 +0900 Bilibili [Downloader] New Task CID: 22257880
default 17:59:37.275273 +0900 Bilibili TIC TCP Conn Start [76:0x618000192890]
default 17:59:37.275273 +0900 Bilibili TIC TCP Conn Start [77:0x610000396310]
default 17:59:37.282354 +0900 Bilibili TIC TCP Conn Event [76:0x618000192890]: 1 Err(0)
default 17:59:37.282378 +0900 Bilibili TIC TCP Conn Connected [76:0x618000192890]: Err(0)
default 17:59:37.282488 +0900 Bilibili TIC Enabling TLS [76:0x618000192890]
default 17:59:37.283372 +0900 Bilibili TIC TCP Conn Event [77:0x610000396310]: 1 Err(0)
default 17:59:37.283397 +0900 Bilibili TIC TCP Conn Connected [77:0x610000396310]: Err(0)
@matthew-z
matthew-z / # macvim - 2016-02-22_11-11-38.txt
Created February 22, 2016 02:12
macvim on OS X 10.11.3 - Homebrew build logs
Homebrew build logs for macvim on OS X 10.11.3
Build date: 2016-02-22 11:11:38