Skip to content

Commit 1fe6976

Browse files
committed
reset for bloomberg
1 parent 3636186 commit 1fe6976

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

examples/keras-perceptron/nn.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import tensorflow as tf
2+
import wandb
3+
4+
# logging code
5+
run = wandb.init()
6+
config = run.config
7+
8+
# load data
9+
(X_train, y_train), (X_test, y_test) = tf.keras.datasets.mnist.load_data()
10+
img_width = X_train.shape[1]
11+
img_height = X_train.shape[2]
12+
13+
# one hot encode outputs
14+
y_train = tf.keras.utils.to_categorical(y_train)
15+
y_test = tf.keras.utils.to_categorical(y_test)
16+
labels = [str(i) for i in range(10)]
17+
18+
num_classes = y_train.shape[1]
19+
20+
# create model
21+
model = tf.keras.models.Sequential()
22+
model.add(tf.keras.layers.Flatten(input_shape=(img_width, img_height)))
23+
model.add(tf.keras.layers.Dense(num_classes))
24+
model.compile(loss='mse', optimizer='adam',
25+
metrics=['accuracy'])
26+
27+
# Fit the model
28+
model.fit(X_train, y_train, epochs=10, validation_data=(X_test, y_test),
29+
callbacks=[wandb.keras.WandbCallback(data_type="image", labels=labels, save_model=False)])
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[default]
2-
entity: qualcomm
3-
project: digits-sep9
2+
entity: bloomberg-class
3+
project: digits
44
base_url: https://api.wandb.ai

0 commit comments

Comments
 (0)