An AI library written using only NumPy
Project description
Coralearn
An AI library written using only NumPy.
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
- NAG
- AdaGrad
- RMSprop
- Adam
Activations ⏰
- relu
- linear_activation
- softmax
- sigmoid
Neural Network Components 🏗️
- Dense (fully connected layer)
- Sequential (model container)
- CNN coming soon
Project details
Release history Release notifications | RSS feed
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.1.tar.gz
(11.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
coralearn-0.2.1-py3-none-any.whl
(18.2 kB
view details)
File details
Details for the file coralearn-0.2.1.tar.gz.
File metadata
- Download URL: coralearn-0.2.1.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e84b879960722750826e7762b1b91d0604a6de5c7ed63661ea50b38a1c2e408c
|
|
| MD5 |
c56119ab4c011c9856b4089977aab6a0
|
|
| BLAKE2b-256 |
a6d9eb69bb9babfa73a27ee71abd4ab5e4e16da0ed233388640386f4e1e3abec
|
File details
Details for the file coralearn-0.2.1-py3-none-any.whl.
File metadata
- Download URL: coralearn-0.2.1-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e34af262f3aaefec182efdcc294d6fa884df4b3ac1cc674614971382f5b9e21e
|
|
| MD5 |
3c69c279434f66e5d468bca6c53cdaf1
|
|
| BLAKE2b-256 |
53e9b3fd251ace5aba4697ac352eeb15c5067c3c125472ec37fee36d35731c94
|