NN GitHub

NN: Python Neural Network Library

A neural network library built on top of TensorFlow for quickly building deep learning models.


Install TensorFlow:

pip install tensorflow

and run:

pip install nn

It is recommended to use a virtual environment.


Import the package:

import nn

Create the model:

def model(inputs):
    # Define the network architecture (layers, number of units, activations)
    hidden = nn.Dense(units=64, activation='relu')(inputs)
    outputs = nn.Dense(units=10)(hidden)

    # Configure the learning process (loss, optimizer, evaluation metrics)
    return dict(outputs=outputs,
                optimizer=('GradientDescent', 0.001),

Save/load model parameters, training progress etc. by specifying a model directory:

def model(inputs):

Train the model using training data:

model.train(x_train, y_train, epochs=30, batch_size=128)

Evaluate the model performance on test or validation data:

loss_and_metrics = model.evaluate(x_test, y_test)

Use the model to make predictions for new data:

predictions = model.predict(x)
# or call the model directly
predictions = model(x)

Next Steps