This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AngularFireModule } from 'angularfire2'; | |
import { firebaseConfig } from '../environment'; | |
import { AngularFireDatabaseModule } from 'angularfire2/database'; | |
import { AngularFireAuthModule } from 'angularfire2/auth'; | |
// imports: [ の中に、以下を挿入。(一行前の最後にカンマも挿入) | |
AngularFireModule.initializeApp(firebaseConfig), // imports firebase/app needed for everything |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import numpy as np | |
import matplotlib.pyplot as plt | |
rng = np.random.RandomState(123) | |
d = 2 # データの次元 | |
N = 10 # 各パターンのデータ数 | |
mean = 5 # ニューロンが発火するデータの平均値 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import numpy as np | |
import matplotlib.pyplot as plt | |
''' | |
データの生成 | |
''' | |
rng = np.random.RandomState(123) | |
d = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (x1, y1), (x2, y2)を結ぶ線分のグラフ | |
%matplotlib inline | |
import matplotlib.pyplot as plt | |
plt.plot([x1, x2], [y1, y2], color='k', linestyle='-', linewidth=1) | |
# 例 | |
%matplotlib inline | |
import matplotlib.pyplot as plt | |
plt.plot([-2, 7], [10.375, -4.67], color='k', linestyle='-', linewidth=1) | |
plt.xlim([-4,8]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from keras.models import Sequential | |
from keras.layers import Dense, Activation | |
from keras.optimizers import SGD | |
from keras.models import model_from_json | |
# モデルを読み込む | |
model = model_from_json(open('my_model34.json').read()) | |
# 学習結果を読み込む |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 3.5 多クラスロジスティック回帰 Keras 、モデルと学習結果の読み込みと予測 | |
import numpy as np | |
from keras.models import Sequential | |
from keras.layers import Dense, Activation | |
from keras.optimizers import SGD | |
from sklearn.utils import shuffle | |
from keras.models import model_from_json | |
# モデルを読み込む |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
np.random.seed(0) # 乱数シード | |
M = 2 # 入力データの次元 | |
K = 3 # クラス数 | |
n = 100 # クラスごとのデータ数 | |
N = n * K # 全データ数 | |
''' | |
データの生成 | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 3.6 perceptron, Keras, graph2 | |
import numpy as np | |
from keras.models import Sequential | |
from keras.layers import Dense, Activation | |
from keras.optimizers import SGD | |
np.random.seed(123) | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/m0t0k1ch1/keras-sample/blob/master/mnist_mlp.py のEpoch数のみ変更 | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
np.random.seed(20160715) # シード値を固定 | |
from keras.datasets import mnist | |
from keras.models import Sequential | |
from keras.layers.core import Dense, Dropout, Activation | |
from keras.utils import np_utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fruit.py from http://qiita.com/hiroeorz@github/items/ecb39ed4042ebdc0a957 | |
from keras.models import Sequential | |
from keras.layers import Activation, Dense, Dropout | |
from keras.utils.np_utils import to_categorical | |
from keras.optimizers import Adagrad | |
from keras.optimizers import Adam | |
import numpy as np | |
from PIL import Image | |
import os |
OlderNewer