Skip to main content

An AI library written using only NumPy

Project description

Coralearn

An AI library written using only NumPy.

PyPI Python Downloads License


Installation⬇️

pip install coralearn

Quick Example

Here’s a simple neural network example using CoraLearn:

import numpy as np
import pandas as pd

from coralearn.neural_network import Dense, Sequential
from coralearn.optimizers import SGDMomentum
from coralearn.activations import relu, linear_activation
from coralearn.losses import mean_squared_error
from coralearn.scalers import MinMaxScaler

# Alternatively, you can import everything directly from coralearn
# from coralearn import Dense, Sequential, relu, linear_activation, mean_squared_error, SGDMomentum, MinMaxScaler

# Load training data
train_data = pd.read_csv("Train.csv")

X = train_data[["col1", "col2", "col3"]].values   # your chosen input columns
y = train_data["target"].values                   # target column

# Scale the input features
scaler = MinMaxScaler()
X_scaled = scaler.fit_transform(X)

# Build a sequential model
model = Sequential([
    Dense(input_size=32, output_size=16, activation=relu),
    Dense(input_size=16, output_size=8, activation=relu),
    Dense(input_size=8, output_size=1, activation=linear_activation),
])

# Compile with loss function and an optimizer
model.compile(loss=mean_squared_error, optimizer=SGDMomentum(lr=0.05))

# Train the model
model.train(X_scaled, y, epochs=20, batch_size=32)

# Make a prediction on new data
X_new = np.random.rand(5, 32)   # example new inputs
X_new_scaled = scaler.transform(X_new)

y_pred = model.forward(X_new_scaled)
print("Predictions:", y_pred)

Current Features

Scalers 🔢

  • MinMaxScaler
  • RobustScaler
  • StandardScaler

Losses 📉

  • binary_cross_entropy
  • mean_squared_error
  • sparse_categorical_cross_entropy

Optimizers⚡

  • SGD
  • SGDMomentum

Activations ⏰

  • relu
  • linear_activation
  • softmax
  • sigmoid

Neural Network Components 🏗️

  • Dense (fully connected layer)
  • Sequential (model container)
  • CNN coming soon

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

coralearn-0.2.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

coralearn-0.2-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file coralearn-0.2.tar.gz.

File metadata

  • Download URL: coralearn-0.2.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for coralearn-0.2.tar.gz
Algorithm Hash digest
SHA256 abcda08f92ef0e762d6440634cf2d64fda8c088de101fee33a5503d7b95e09e6
MD5 809fef30136005b45d4fd2cfe7d2af96
BLAKE2b-256 52681e034ccd337692d89a37203d391224a5b6c0c16a4c32ec1fe8aa2623e1d0

See more details on using hashes here.

File details

Details for the file coralearn-0.2-py3-none-any.whl.

File metadata

  • Download URL: coralearn-0.2-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for coralearn-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0e4e3de52f93ca5ce48ab99167f3427de2b67e728b2ac6bd05a92aae042e5373
MD5 6688693bf67c8a96838ee18803d14acb
BLAKE2b-256 10b41a05836174215948a1a738fdb3f83e63b9ac149bf6ac325e638afde674a5

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