### Goals

- Using Keras

#### Exercise 1.1

Upgrade tensorflow to the latest version.

```
!pip install tensorflow --upgrade
```

See the version installed on your machine

```
import tensorflow as tf
```

print(tf.__version__)

For example, you may get the following value

```
2.0.0
```

In order to create the above neural network model, you can test the following code.

```
from tensorflow.keras.models import Sequential
```

from tensorflow.keras.layers import Conv2D

from tensorflow.keras.layers import MaxPool2D

from tensorflow.keras.layers import Flatten

from tensorflow.keras.layers import Dense

# Creating a sequential model

model = Sequential()

model.add(Dense(4, activation='relu', input_shape=(3,)))

model.add(Dense(units=2, activation='softmax'))

# compiling the model

model.compile(loss='mse',

optimizer='sgd',

metrics=['accuracy']

In the above model, we use Stochastic gradient descent optimizer and mean square error as the loss calculator.

In the code below, we use a SGD optimizer using a learning rate of 0.01.

```
from tensorflow.keras.models import Sequential
```

from tensorflow.keras.layers import Conv2D

from tensorflow.keras.layers import MaxPool2D

from tensorflow.keras.layers import Flatten

from tensorflow.keras.layers import Dense

from tensorflow.keras.optimizers import SGD

# Creating a sequential model

model = Sequential()

model.add(Dense(4, activation='relu', input_shape=(3,)))

model.add(Dense(units=2, activation='softmax'))

# compiling the model

sgd = SGD(lr=0.01)

model.compile(loss='mean_squared_error', optimizer=sgd,

metrics=['accuracy'])

##### MNIST and Sequential model

Please run the following code https://github.com/keras-team/keras/blob/master/examples/mnist_mlp.py

Observe the different layers: 2 hidden layers and 2 dropouts.

#### Exercise 1.2

##### MNIST and Convolutional neural networks

Please check and run the following code https://github.com/keras-team/keras/blob/master/examples/mnist_cnn.py

Observe the different layers: 2D convolutional network, dropout, maxpooling and flatten.

##### LSTM models

**Example 1 (Time Series Prediction with LSTM models)**: Please check and run the following code https://machinelearningmastery.com/time-series-prediction-lstm-recurrent-neural-networks-python-keras/

**Example 2 (Text generation using LSTM models)**: Please check and run the following code https://github.com/keras-team/keras/blob/master/examples/lstm_text_generation.py

Observe how sequences are generated in these examples.

#### Submission

- Rename your notebook as Name1_Name2_[Name3].ipynb, where Name1, Name2 are your names.
- Submit your notebook online.
- Please
**don't**submit your JSON, TSV and CSV files.