## Keras Basic Neural Network

Keras supports a range of neural networks. Basic neural network is a standard structure of a layers followed by other layers.

### Parameters

= a tuple defining the number of neurons per hidden layer. default is (100,) which means one hidden layer of 100 neurons. (100, 100) would mean two hidden layers of 100 neurons.*hidden_layers*= the activation function used in the neurons. Default is "relu". Other activation functions include: {‘identity’, ‘logistic’, ‘tanh’, ‘relu’, 'elu', 'leaky relu'}*activation_fn*= This is the type of algorithm used for the gradient descent. Default is "adam", other choices include: {‘lbfgs’, ‘sgd’, ‘adam’}*solver*= The L2 regularization penalty, default is: 0.0001*alpha*= Number of input variables being fed into the neural network*n_classes*= Number of nodes in the first layer of the neural network*first_layer*= Default is False. If set to True, 50% of the nodes in each layer will be randomly frozen. This is to reduce the amount of reliance each node has on each other.*dropout_option*

### Practical Example

```
from deployml.keras import NeuralNetworkBase
# We define the model with the number of inputs which is the number
# of keys minus one as one will be the outcome. First layer also
# the same number but it doesn't have to be
NN = NeuralNetworkBase(hidden_layers=(4, 4),
first_layer=len(input_data.keys())-1,
n_classes=len(input_data.keys())-1)
# We define the data (pandas data frame)
NN.data = input_data
# We define the key of the column we are trying to predict
NN.outcome_pointer = 'attended'
# Now we've defined the network we produce a training curve
# and show it with scaled data using a standard scaler
NN.train(scale=True, batch_size=100)
NN.show_learning_curve()
# We then print out the precision, recall and F-1 score
NN.evaluate_outcome()
# And show the ROC curve
NN.show_roc_curve()
```

## Not Enough?

It's understandable that you might want a more custom model. Whilst we are always working on making Deploy-ML more versatile, you can define your own Keras model and import it into the Deploy-ML learning and packaging framework!