Skip to content

Instantly share code, notes, and snippets.

@icoxfog417
icoxfog417 / gist:f9ead88d5436933c7b84
Created January 22, 2015 04:39
theano test error'2015/1/22(
Problem occurred during compilation with the command line below:
c:\Users\tie301837\Documents\environments\msys32\usr\bin\g++.exe -shared -g -O3
-fno-math-errno -Wno-unused-label -Wno-unused-variable -Wno-write-strings -share
d -IC:/Users/tie301837/Documents/environments/msys32/mingw32/include -LC:/Users/
tie301837/Documents/environments/Python/Continuum/Miniconda3/envs/deeplearn/libs
-lpython34 -march=haswell -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse
4a -mcx16 -msahf -mmovbe -maes -mno-sha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -
mno-fma4 -mno-xop -mbmi -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -
mrtm -mhle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mx
save -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-pref
@icoxfog417
icoxfog417 / simple_notebook
Created February 27, 2015 02:14
simple ipython notebook
{
"metadata": {
"name": "",
"signature": "sha256:ff91c99359ae721ccc385e2237c0826eda47a7a9767f2f724933a6eecc02d799"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@icoxfog417
icoxfog417 / net_confirm
Created March 18, 2015 05:05
python3 confirn network connection
import urllib.request
import urllib.request as request
request.urlopen("http://www.google.co.jp").status
>>>200
@icoxfog417
icoxfog417 / requirements.txt
Last active October 3, 2015 10:21
machine_learning_environment
numpy>=1.9.2
scipy>=0.15.1
scikit-learn>=0.16.0
matplotlib>=1.4.0
cython>=0.22
ipython>=3.1.0
@icoxfog417
icoxfog417 / get_member_fields
Created July 8, 2015 08:38
extract class member fields
import inspect
fields = inspect.getmembers(instance, lambda a: not(inspect.isroutine(a)))
@icoxfog417
icoxfog417 / example.py
Last active August 29, 2015 14:26
pystan example
def main():
import pystan
schools_code = """
data {
int<lower=0> J; // number of schools
real y[J]; // estimated treatment effects
real<lower=0> sigma[J]; // s.e. of effect estimates
}
@icoxfog417
icoxfog417 / example.py
Created August 4, 2015 05:39
pymc example
def main():
import pymc as pc
import pymc.Matplot as pt
import numpy as np
from scipy.stats import bernoulli
def model(data):
theta_prior = pc.Beta('theta_prior', alpha=1.0, beta=1.0)
coin = pc.Bernoulli('coin', p=theta_prior, value=data, observed=True)
@icoxfog417
icoxfog417 / create_data.py
Created August 22, 2015 09:32
create image data
import os
from datetime import datetime
import requests
API_KEY = "your_key"
API_SECRET = "your_secret"
def read_file(path):
lines = []
@icoxfog417
icoxfog417 / coloring.py
Created September 4, 2015 17:05
coloring text in ipython notebook
from IPython.core.display import HTML
color="255,127,80" # coral
def print_color(c):
source = "<h1 style='color: rgb({0})'>Color Text</h1>".format(c)
return HTML(source)
print_color(color)
@icoxfog417
icoxfog417 / check_package.py
Created September 10, 2015 08:07
check package existence in Python3
def check(name):
from importlib import util
spec = util.find_spec(name)
return True if spec else False