A Framework to for developing Deep Leanring models
Project description
Aroma DL-Framework
Aroma is a deep learning framework implemented in python
Install
pip insall pyaroma
Dependencies
pip install -r requirements.txt
NOTE: you need to pip install kaggle so you need provide kaggle.json file in your environment, check this link
Design
Aroma is designed based on 5 modules:
-
nn module: which contains the core modules of the framework such as layers, activations, losses, parameters, forward and backward modules
-
optim module: which contains the optimizers for updating the weights (NOTE: currently supporting just Adam and SGD)
-
eval module: which contains the evaluation metrices for the model
-
vis module: which contains the visualization module for live loss update & others
-
utils module: which contains the dataloader that process data for training and validation and support auto download for mnist dataset from kaggle, and others helper classes and functions for the framework
Demo
from nn.model import Model
from nn.activations import *
from nn.layers import *
from nn.losses import *
from optim.optimizers import Adam, SGD
from utils.dataloader import DataLoader
from eval.evaluation import Evaluation
from viz.visualization import Visualization
from utils.transforms import Transform
from tqdm import tqdm
INPUT_FEATURE = 784
data_loader = DataLoader(batch_size=64, dataset_path="../")
# Training
X_train, y_train = data_loader.get_train_data()
trans = Transform()
X_train = trans.normalize(X_train)
batches = data_loader.get_batched_data(X_train, y_train)
# Validation
X_val, Y_val = data_loader.get_validation_data()
X_val = trans.normalize(X_val)
model = Model([Linear(INPUT_FEATURE,128, init_type='xavier'),
ReLU(),
Linear(128,64, init_type='xavier'),
ReLU(),
Linear(64,32, init_type='xavier'),
ReLU(),
Linear(32,16, init_type='xavier'),
ReLU(),
Linear(16,10, init_type='xavier'),
Softmax()], loss=NLLLoss(), optimizer=Adam(lr=0.001))
epoch = 16
vis = Visualization()
for i in range(epoch):
for X,Y in tqdm(batches):
y_pred = model.forward(X)
loss = model.compute_cost(Y, y_pred)
model.backward()
model.step()
vis.plot_live_update(xlabel="Epoch No.", x=i + 1, ylabel="Loss", y=loss)
vis.pause_figure()
model.save_model()
# Evaluating model
Pred_ = model.predict(X_val)
Pred_ = np.argmax(Pred_, axis=0)
Y_val = Y_val.T.squeeze()
eval = Evaluation(Y_val, Pred_, average='weighted')
acc = eval.compute_accuracy()
prec = eval.compute_precision()
recall = eval.compute_recall()
f1_score = eval.compute_f1_score()
conf_mat = eval.compute_confusion_mat()
print("Accuracy: ",acc,"Precision: ",prec,"Recall: ",recall,"F1_Score: ",f1_score)
vis.plot_confusion_matrix(conf_mat)
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
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
File details
Details for the file pyaroma-0.1.tar.gz.
File metadata
- Download URL: pyaroma-0.1.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c2d3a6ac86420c594a8dff2aa5f4ef7f9ae3a39acb229f0180abd37689f1029
|
|
| MD5 |
b04f3a742ba05c38b5a7b4ba97c3e2de
|
|
| BLAKE2b-256 |
e74ea25a22f87ea3983d1d36734f175a22ec2e721c82bac93870defd05e41367
|
File details
Details for the file pyaroma-0.1-py3-none-any.whl.
File metadata
- Download URL: pyaroma-0.1-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66c8e902faddf2e1a0f7da0e7b5a65868a448212703fcad0ea065e894d9fc9e3
|
|
| MD5 |
00249f7d0fd5c7770f14d049c5cc2a72
|
|
| BLAKE2b-256 |
aefc3e23985f0399cb9714b63c75736b896329c415b379a529709dff7989dd52
|