In [0]:
!pip install -q tf-nightly-gpu-2.0-preview
In [2]:
import tensorflow as tf
print(tf.__version__)
In [0]:
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
import numpy as np
from tensorflow import keras
In [4]:
!curl -O https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/master/data/insurance-customers-1500.csv
In [5]:
df = pd.read_csv('./insurance-customers-1500.csv', sep=';')
y = df['group']
df.drop('group', axis='columns', inplace=True)
X = df.as_matrix()
In [6]:
df.head()
Out[6]:
In [7]:
X.shape
Out[7]:
In [8]:
y.head()
Out[8]:
In [9]:
y.shape
Out[9]:
In [0]:
from tensorflow.keras.layers import Dense
In [0]:
# getting help
Dense?
In [12]:
# this is broken, fix
model = keras.Sequential()
model.add(Dense(name='hidden1', units=??, activation=??, input_dim=3))
# how many hidden layers?
model.add(Dense(name='output', units=??, activation=??))
# model.add(Dense(name='output', units=??, activation=??))
model.summary()
In [0]:
model.fit?
In [17]:
%%time
model.compile(loss='sparse_categorical_crossentropy',
optimizer='adam',
metrics=['accuracy'])
EPOCHS = 500
history = model.fit(X, y, epochs=EPOCHS, batch_size=2000, verbose=0)
In [18]:
train_loss, train_accuracy = model.evaluate(X, y)
train_accuracy
Out[18]:
In [19]:
# plt.yscale('log')
plt.ylabel("accuracy")
plt.xlabel("epochs")
plt.plot(history.history['accuracy'])
Out[19]:
In [20]:
model.predict(np.array([[100, 48, 10]]))
Out[20]:
In [0]: