<jupyter_start><jupyter_text>Create your first high level TensorFlow Model<jupyter_code>!pip install -q tf-nightly-gpu-2.0-preview
import tensorflow as tf
print(tf.__version__)
import matplotlib.pyplot as plt
import pandas as pd
import tensorflow as tf
import numpy as np
from tensorflow import keras
!curl -O https://raw.githubusercontent.com/DJCordhose/deep-learning-crash-course-notebooks/master/data/insurance-customers-1500.csv
df = pd.read_csv('./insurance-customers-1500.csv', sep=';')
y = df['group']
df.drop('group', axis='columns', inplace=True)
X = df.as_matrix()<jupyter_output>/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:4: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
  after removing the cwd from sys.path.<jupyter_text>Input data now is in X, labels are in y<jupyter_code>df.head()
X.shape
y.head()
y.shape<jupyter_output><empty_output><jupyter_text>Create your model here<jupyter_code>from tensorflow.keras.layers import Dense
# getting help
Dense?
# 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()
model.fit?
%%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)
train_loss, train_accuracy = model.evaluate(X, y)
train_accuracy
# plt.yscale('log')
plt.ylabel("accuracy")
plt.xlabel("epochs")

plt.plot(history.history['accuracy'])
model.predict(np.array([[100, 48, 10]]))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1449520586576424, 'fraction_numerical': 0.01692047377326565, 'mean_word_length': 6.011857707509882, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '158198', 'license': 'MIT', 'n_tokens_mistral': 659, 'n_tokens_neox': 630, 'n_words': 134, 'path': 'notebooks/tf2/nn-model.ipynb', 'repo_name': 'subodhchhabra/ai', 'size': '1773'}