Skip to content

Instantly share code, notes, and snippets.

View akimach's full-sized avatar
💭
I may be slow to respond.

akimach

💭
I may be slow to respond.
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Title: Linear regression of Housing Values in Suburbs of Boston using PyData
Slug: linear-regression-with-python
Date: 2017-11-06 0:00
Category: Notebook
Tags: Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@akimach
akimach / destructuring.js
Created November 5, 2017 09:23
use object destructuring, prefer-destructuring
const hoge = results.hoge;
// ↓
const { hoge } = results;
@akimach
akimach / file0.txt
Last active December 25, 2017 13:32
Android Thingsの概要とKotlinでのLチカ ref: https://qiita.com/akimach/items/07cc61b16068336be86a
import android.app.Activity
import android.os.Build
import android.os.Bundle
import android.util.Log
import com.google.android.things.pio.PeripheralManagerService
class MainActivity : Activity() {
private val TAG = "MainActivity"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
from __future__ import print_function
import tensorflow as tf
class FizzBuzz():
def __init__(self, length=30):
self.length = length
self.array = tf.Variable([str(i) for i in range(1, length+1)], dtype=tf.string, trainable=False)
self.graph = tf.while_loop(self.cond, self.body, [1, self.array],
shape_invariants=[tf.TensorShape([]), tf.TensorShape(self.length)],
back_prop=False)
def run(self):
@akimach
akimach / file0.py
Last active October 1, 2017 11:51
GestureAI ― Keras + CoreML + iOS 11を用いた RNNによるジェスチャー認識 ref: http://qiita.com/akimach/items/d43cd04b5de5fa99bb6a
timesteps = 40 # 最大系列長
input_dim = 3 # 入力次元
df = pd.read_csv('example.csv')
seq = df.as_matrix()
seq_length = seq.shape[0] # 対象となるデータの系列長
seq_0padding = np.r_[seq, np.zeros((timesteps-seq_length, input_dim))]
@akimach
akimach / file0.py
Last active July 19, 2018 09:29
怠け者のためのディープラーニング入門 - Early Stopping(早期終了) ref: https://qiita.com/akimach/items/d9341df56e3bb63b33d5
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras import optimizers
from keras.callbacks import EarlyStopping
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
# Setup dataset
np.random.seed(1234)
@akimach
akimach / file0.py
Created September 23, 2017 04:50
怠け者のためのディープラーニング入門 - ハイパーパラメータのチューニング ref: http://qiita.com/akimach/items/a10154e0f0e6dcaafdd0
import numpy as np
np.random.seed(1234)
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras import optimizers
from keras.wrappers.scikit_learn import KerasClassifier
from sklearn.utils import shuffle
from sklearn.model_selection import GridSearchCV
@akimach
akimach / file0.py
Last active March 20, 2018 10:31
怠け者のためのディープラーニング入門 - 性能指標・検証手法 ref: https://qiita.com/akimach/items/f572310b01079515eaf5
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
from sklearn import svm
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score
from sklearn.metrics import f1_score
np.random.seed(1234)
n_data = 200