Skip to main content

Phito-Deep

Phito-Deep is a deep learning framework built from scratch with only numpy. This is being actively developed as part of my learning journey to becoming a machine learning engineer. I'm using it to better understand the underlying algorithms that power modern deep learning frameworks and architectures.

Installation

$ pip install phitodeep

Usage

MNIST quickstart:

import numpy as np
from datasets import load_dataset

from phitodeep.model import SequentialBuilder
from phitodeep.loss import CategoricalCrossEntropy
from phitodeep.optimization.optimizers import Adam
from phitodeep.optimization.initialization import Xavier, InitType

train_dataset = load_dataset("ylecun/mnist", split="train")
test_dataset = load_dataset("ylecun/mnist", split="test")

X_train = train_dataset["image"]
y_train = train_dataset["label"]
X_test = test_dataset["image"]
y_test = test_dataset["label"]

X_train = np.array(X_train).astype(np.float32) / 255.0
y_train = np.array(y_train)
X_test = np.array(X_test).astype(np.float32) / 255.0
y_test = np.array(y_test)
print(X_train.shape, y_train.shape)

model = (
    SequentialBuilder()
    .flatten()
    .dense(784, 128)
    .relu()
    .dense(128, 64, Xavier(InitType.NORMAL))
    .relu()
    .dense(64, 10, Xavier(InitType.NORMAL))
    .softmax()
    .optimizer(Adam())
    .loss(CategoricalCrossEntropy())
    .alpha(0.05)
    .epochs(5)
    .batch(64)
    .build()
)

model.summary()

model.train(X_train, y_train, X_test, y_test)

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

phitodeep was created by Ralph Dugue. It is licensed under the terms of the Apache License 2.0 license.

Credits

phitodeep was created with cookiecutter and the py-pkgs-cookiecutter template.

Metadata

Release files for phitodeep 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phitodeep 0.2.3
File Size Uploaded
phitodeep-0.2.3.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phitodeep 0.2.3
File Interpreter ABI Platform
phitodeep-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / phitodeep-0.2.3.tar.gz

Download URL phitodeep-0.2.3.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
98045755cc336d3d14836bf8cbd7173476654d0fb2bd73f2e75b329dd4544f09
BLAKE2b-256 checksum
How to use checksums
eb70b75a1774fbea6b6856fa0ee8e9a759f97461567f17de12f2d33f4be4958e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / phitodeep-0.2.3-py3-none-any.whl

Download URL phitodeep-0.2.3-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3835b9f0bb330f7be787da7bd442a0fdb6b661838e3f81d1428d92d7b565281
BLAKE2b-256 checksum
How to use checksums
8fea6ea3d062d21ab7b9a90ec73c791c6505fff6563caa97d020f195f5998c25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.16 {"installer":{"name":"uv","version":"0.11.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page