Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

GliaML - Python Machine Learning Library

Project description

# GliaML

GliaML is simple, yet powerful machine learning library written in Python.

Currently, it allows a user to easily create a multi-layer perceptron neural network with the following features:

  1. Allow backpropagation with the sigmoid, tanh, and ReLU activation functions.
  2. Allow normalisation of a classifier with the softmax function.
  3. Allow learning rate hyperparameter functionality (including biases)
  4. Allow L2 regularisation to prevent over-fitting

## Creating a Network

In GliaML, neural networks are implemented as objects containing a collection of layers, which are in turn objects. To create a layer, first a list of activation functions for each neuron in the list must be chosen. Then the layer can be created. Bias functionality can be

activations1 = [activation_id for i in range(0, num_neurons)] layer1 = NetworkLayer(num_inputs, num_neurons, activations1, bias=False)

After a satisfactory number of layers have been created, the neural network itself can be invoked by calling the constructor and providing all the layers. If

network = NeuralNetwork(l2_regularization=0.03, layer1, layer2, …)

## Training a network

After creating your network, you’ll want to provide training and testing data. These should be formatted as NumPy arrays. For example, let us consider the following training set.

training_inputs = np.array([[1, 0, 1], [0, 0, 1], [1, 1, 0], [0, 1, 0]]) training_outputs = np.array([[1, 1, 0, 0]]).T

The solution is whether or not there is a 1 or 0 in the 3rd place of the input array. We now need to train the network. We can either use mean-squared error or cross-entropy loss.

network.train_mean_squared_error(training_inputs, training_outputs, num_iterations,
learning_rate=0.05, bias_learning_rate=0.05)

We can now see the network’s response on a problem it hasn’t seen before.

answer = network.think(np.array([1, 1, 1])) print(answer[-1])

See []( for another usage example.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gliaml, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size gliaml-0.1.1-py3-none-any.whl (14.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size gliaml-0.1.1.tar.gz (8.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page