Skip to main content

Transparent ML is a simple and lightweight machine learning library.

Project description

transparentml

Transparent ML is a lightweight, educational machine learning library built from scratch with NumPy. It provides simple implementations of common supervised and unsupervised learning algorithms for experimentation, learning, and small projects.

Why choose transparentml?

  • Simple, readable implementations designed for learning and teaching.
  • Built with NumPy only, with no heavy dependencies.
  • Includes both classical ML algorithms and basic clustering methods.
  • Easy to inspect and modify for educational purposes.

Features

The package currently includes:

  • Linear regression
  • Logistic regression
  • SGD regression
  • K-nearest neighbors
  • K-means clustering
  • Decision trees

Installation

Install from PyPI:

pip install transparentml

Quick start

import numpy as np
from transparentml.linear_models.linear_regression import LinearRegression

X = np.array([[1.0], [2.0], [3.0], [4.0]])
y = np.array([2.0, 4.0, 6.0, 8.0])

model = LinearRegression()
model.fit(X, y)

predictions = model.predict(np.array([[5.0]]))
print(predictions)

Example usage

Linear regression

from transparentml.linear_models.linear_regression import LinearRegression

model = LinearRegression()
model.fit(X_train, y_train)
preds = model.predict(X_test)

Logistic regression

from transparentml.linear_models.logistic_regression import LogisticRegression

model = LogisticRegression(learning_rate=0.1, epochs=100)
model.fit(X_train, y_train)
probabilities = model.predict_proba(X_test)

K-means clustering

from transparentml.clustering.kmeans import KMeans

model = KMeans(n_clusters=3, random_state=42)
labels = model.fit_predict(X)

K-nearest neighbors

from transparentml.neighbors.knn import KNN

model = KNN(n_neighbours=5)
model.fit(X_train, y_train)
preds = model.predict(X_test)

Decision tree

from transparentml.tree.decision_tree import DecisionTree

model = DecisionTree(min_samples_split=2, max_depth=3)
model.fit(X_train, y_train)
preds = model.predict(X_test)

Project status

This project is currently in early development and is best suited for learning, experimentation, and educational use. It is not intended to be a full replacement for production-grade libraries such as scikit-learn.

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome. If you want to improve the package, add examples, or fix issues, feel free to open a pull request or issue on GitHub.

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

transparentml-0.1.0.tar.gz (350.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transparentml-0.1.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file transparentml-0.1.0.tar.gz.

File metadata

  • Download URL: transparentml-0.1.0.tar.gz
  • Upload date:
  • Size: 350.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for transparentml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8d0fb0dbb4243a56c6c3af6f0691ab91581da5f66151102465894dbd0f27c9ca
MD5 4f8be25af6f14b31f946e9eb59ec1eed
BLAKE2b-256 ce27c3ff8d6b962536357994e5d6e58b13afed7083b3adc196f77945de24f342

See more details on using hashes here.

File details

Details for the file transparentml-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: transparentml-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","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}

File hashes

Hashes for transparentml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c10b332e2228a0c3c403240c7b7948a1524a6cc89ffc82a317765c4ec126d9a
MD5 61f054630d44021b8994caa537be9d73
BLAKE2b-256 8eec6d7c4a3321dde604fd49364e178962cf38ce8913971c19ee53ca37930b7a

See more details on using hashes here.

Supported by

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