Skip to content

Instantly share code, notes, and snippets.

View ikegami-yukino's full-sized avatar

IKEGAMI Yukino ikegami-yukino

View GitHub Profile
@Bollegala
Bollegala / ADAMvsAdaGrad.py
Created March 10, 2015 18:33
ADAM vs AdaGrad
"""
This program compares ADAM vs AdaGrad. You can modify the function f and its gradient grad_f
in the code, run the two algorithms and compare their convergence. For the simple function
f(x1, x2) = (x1 - 2) ** 2 + (x1 + 3) ** 2, (alpha = 0.1 and tolerence 1e-3)
AdaGrad converged at 2023 iterations, whereas ADAM required only 83!
"""
import numpy
@esehara
esehara / oogiri.py
Created April 25, 2015 04:40
メカ大喜利マン ver 0.1
# -*- coding: utf-8 -*-
from gensim.models import word2vec
import MeCab
import random
model = word2vec.Word2Vec.load("oogiri_gensim.model")
tagger = MeCab.Tagger("-Ochasen")
def word_and_kind_parse(line):
line_word = line.split("\t")
if len(line_word) < 2:
@masayu-a
masayu-a / gist:64ba39287ae8b3b5b498
Last active December 19, 2019 06:31
BCCWJ Copyright

BCCWJ のうちコピーライトフリーで再配布可能なサンプル

  • OW6X_00000 (コアデータに内包)
  • OW6X_00027
  • OW6X_00165
  • OW6X_00657

BCCWJ の新聞データの取り扱い

  • BCCWJ の新聞データは統計情報であっても商用利用不可
  • BCCWJ の新聞データを含むデータから学習した解析モデルは BSD/GNU などの商用可ライセンスで再配布してはいけない
@katzchang
katzchang / sleep-well.md
Last active August 20, 2024 01:51
処理が成功するまで実行しつづける - @katzchang.gist

処理が成功するまで実行しつづける

インスタンスの起動スクリプトとかを書いてるときによく欲しいと思うやつです。

例えば、 service nginx start が実行されたあとに curl -i localhost | grep "200 OK" とかをすると、サービスがそれなりに動いていることが確認できてよかったりするのですが、あまりにも直後だとサーバの起動が間に合わず、curl が失敗してしまいます。nginxだとまだましだけど、アプリケーションサーバだとそれなりに時間がかかったりする。

古典的な解決方法は、 sleep 30 です。簡単だけど、アプリケーションが巨大になってくると30秒では起動しないこともある。じゃぁ sleep 60 が妥当か?でも、サーバインスタンスの起動スクリプト全体はできるだけ早く立ち上がってほしい。困った。

なので、curlが成功するまで叩き続ける、みたいなスクリプトに仕上げたくなるわけです。

@unnonouno
unnonouno / npz_keys.py
Created April 19, 2017 13:51
npz_keys.py
import sys
import numpy
if __name__ == '__main__':
with numpy.load(sys.argv[1]) as f:
print(f.keys())
@tam17aki
tam17aki / CFNCell.py
Last active July 20, 2022 06:25
An implementation of Chaos-Free Network (CFN) in TensorFlow
# -*- coding: utf-8 -*-
# Copyright (C) 2017 by Akira TAMAMORI
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@fukatani
fukatani / hyperopt_chainer.py
Last active February 25, 2019 07:08
How to hyperparameter of deep learning by hyperopt.
try:
import matplotlib
matplotlib.use('Agg')
except ImportError:
pass
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import training
@scapegoat06
scapegoat06 / TopicModelZoo.md
Created February 23, 2018 08:25
Topic Model Zoo
@nakagami
nakagami / jabstract.py
Last active April 4, 2021 05:31
Japanese summarization module using LexRank algorithm.
#!/usr/bin/env python
# The MIT License (MIT)
# Copyright © 2015 Recruit Technologies Co.,Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@GINK03
GINK03 / tor-requests.md
Last active June 13, 2018 16:11
Tor+Requests

torのインストール

$ sudo apt install tor
$ sudo pip3 install pysocks

requestsで使う

IPがそれぞれ異なる