Skip to content

Instantly share code, notes, and snippets.

View smly's full-sized avatar
👁️‍🗨️

smly smly

👁️‍🗨️
View GitHub Profile
# -*- coding: utf-8 -*-
import argparse
import pickle
import os
import re
from subprocess import Popen
import requests
from bs4 import BeautifulSoup
f(x) = \begin{cases}
\frac{n^+(x)}{n(x)}, & \textit{if}\;\,n(x) \ne 0 \\
\frac{N^+}{N}, & \textit{otherwise}
\end{cases}
@smly
smly / keras_interval_evalution.py
Last active February 28, 2021 10:46
An example to check the AUC score on a validation set for each 10 epochs.
"""
An example to check the AUC score on a validation set for each 10 epochs.
I hope it will be helpful for optimizing number of epochs.
"""
# -*- coding: utf-8 -*-
import logging
from sklearn.metrics import roc_auc_score
from keras.callbacks import Callback
th = require 'torch'
mattorch = require 'fb.mattorch'
function main()
train_data = th.load('data/train_all.t7')
test_data = th.load('data/test_all.t7')
print("Convert train_all (mat)")
train_all_mat = {}
for i=1, #train_data do
#!perl
use Benchmark qw(:all);
use Digest::MurmurHash3::PurePerl;
use Digest::MurmurHash3;
my $count = 1e7;
cmpthese($count, {
'Digest::MurmurHash3::PurePerl' => sub { Digest::MurmurHash3::PurePerl::murmur32('this is a test. ignore me.') },
import sys
import random
import json
import time
from influxdb import InfluxDBClient
def generate_gauss_value(mu, sigma, price=100.0, size=6*60*24*30):
current_timestamp = int(time.time())
@smly
smly / Dockerfile
Last active December 28, 2015 07:09
a Dockerfile to build Kafka 0.7 container on EC2
FROM ubuntu:precise
MAINTAINER Kohei Ozaki <i@ho.lc>
ADD kafka-install.sh /kafka-install.sh
RUN /bin/bash /kafka-install.sh
EXPOSE 2888 3888 2181 9092
# CMD /bin/bash /opt/kafka/run
@smly
smly / Dockerfile
Last active January 19, 2016 01:13
a Dockerfile to build InfluxDB container
FROM ubuntu
ADD influxdb-install.sh /influxdb-install.sh
RUN /bin/bash /influxdb-install.sh
EXPOSE 8083 8086
CMD /opt/influxdb/run
@smly
smly / DropoutTopology.java
Created November 6, 2013 02:25
DropoutTopology.java
package sandbox;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import backtype.storm.spout.SpoutOutputCollector;
import backtype.storm.task.OutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.topology.TopologyBuilder;
import backtype.storm.topology.base.BaseRichBolt;
@smly
smly / ml-check.md
Last active December 25, 2015 10:19
http://twitter.com/haruyama/status/389318161503244288 について Matlab で動くことを確認した

Matlab で eigs() を実行する

$ matlab

                            < M A T L A B (R) >
                  Copyright 1984-2010 The MathWorks, Inc.
                Version 7.11.0.584 (R2010b) 64-bit (glnxa64)
                              August 16, 2010