Skip to main content

A slower machine learning framework

Project description

Tensorslow

Tensorslow Logo

Have you ever wanted to to use the power of neural network modeling with absolutely NONE of the rush given by competing neural network frameworks? Well if you answered yes to the previous question then Tensorslow is the machine learning framework to use. Using state of the art Python3 lists rather than any complicated and vectorized backends from languages of yester-year like C++, we seek to use the Zen of Python to make your machine learning models learn at a pace more compatible with that of your three remaining brain-cells (or at least mine). So, get ready to sit back, take a sip of that green-tea, and enjoy the magic of machine learning with absolutely NONE of the stress provided by a machine that works way too quickly for its own good.

Install

To download the code from the repository

git clone git@github.com:oortega20/tensorslow.git

To install the current release of Tensorslow

pip install tensorslow

Try some simple Tensorslow Programs

Some fun matrix manipulations with tensorslow's linear-algebra package

>>> from tensorslow.linalg import Tensor
>>> x = Tensor(list(range(6)), (2,3))
>>> x
Tensor([[0.000 1.000 2.000]
        [3.000 4.000 5.000]])
>>> x @ x.T
Tensor([[5.000 14.000]
        [14.000 50.000]])
>>> x.T @ x
Tensor([[9.000 12.000 15.000]
        [12.000 17.000 22.000]
        [15.000 22.000 29.000]])
>>> x - 3
Tensor([[-3.000 -2.000 -1.000]
        [0.000 1.000 2.000]])
>>> 0 * x
Tensor([[0.000 0.000 0.000]
        [0.000 0.000 0.000]])

A simple demonstration of forward propagation with Tensorslow's available layers and activations

>>> from tensorslow.linalg import Tensor
>>> from tensorslow.activations import Relu
>>> from tensorslow.layers import Dense
>>>
>>> x = Tensor(list(range(6)), (2,3))
>>> x
Tensor([[0.000 1.000 2.000]
        [3.000 4.000 5.000]])
>>> act = Sigmoid()
>>> f = Dense('f', in_dim=3, out_dim=3)
>>> f.weights['w']
Tensor([[0.057 0.051 0.021]
        [0.047 -0.031 0.003]
        [0.015 -0.052 0.058]])
>>> f.weights['b']
Tensor([0.333 0.333 0.333])
>>> out = act(f(x))
>>> out
Tensor([[0.601 0.549 0.611]
        [0.682 0.525 0.667]])
>>>

Inference using Tensorslow MNIST Classifier

from tensorslow.datasets import MNIST
from tensorslow.models import ts_mnist_classifier

model = ts_mnist_classifier(from_ts=True)
data = MNIST(load_train=False, load_test=True, batch_size=128)
x_test, y_test = data.get_test_data()
for x, y in zip(x_test, y_test):
    probs = model.forward(x) # if we only want the class probabilities
    loss, grad = model.forward(x, y) # if we want to compute losses and gradients

Example of simple model training using tensorslow

from tensorslow.datasets import MNIST
from tensorslow.models import ts_mnist_classifier
from tensorslow.optimizers import SGD


data = MNIST(batch_size=128)
x_train, y_train = data.get_train_data()
epochs = 10
model = ts_mnist_classifier(from_ts=False)


opt = SGD(model, learning_rate=5e-4)
train_loss, test_loss = [], []
for epoch in range(epochs):
    for data in zip(x_train, y_train):
        x, y = data
        batch_loss, grad = model(x, y)
        model.backward(grad)
        opt.update()

Details of the Tensorslow MNIST Classifier can be found in a link to our tensorslow-experimentation repository. Improving the accuracy of the current MNIST classifier is something being researched!

Project details


Download files

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

Source Distribution

tensorslow-1.0.3.tar.gz (16.8 MB view details)

Uploaded Source

Built Distribution

tensorslow-1.0.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file tensorslow-1.0.3.tar.gz.

File metadata

  • Download URL: tensorslow-1.0.3.tar.gz
  • Upload date:
  • Size: 16.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for tensorslow-1.0.3.tar.gz
Algorithm Hash digest
SHA256 3d2527e627c293d829c74861b73e7a69e18ad67affbde0d669b993af9257a315
MD5 31620eab5cdd5ffcc34eaa0c11cfa7fd
BLAKE2b-256 c4139261e91b9a4d22f0b7d2001abe98ecd925f9a97940a0bf27fa04c83cf25f

See more details on using hashes here.

File details

Details for the file tensorslow-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: tensorslow-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for tensorslow-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b6515a44fcc4621d6a931636f45978257980eca4947a47cbd13f2d563b6f341a
MD5 fe5ed9ba201465f2cc143ab2bf701812
BLAKE2b-256 11ba1c4eddeea193f78ee97fb3eb6204f5f8ce7c5d436febe25c0f708f636ae5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page