Skip to main content

Implementation of neural network

Project description

DeepLearningKit

Description:

Welcome to DeepLearningKit, a Python library crafted with a passion for learning and a drive to simplify the journey into the depths of neural networks. As my inaugural project in this domain, DeepLearningKit is designed primarily for my educational purposes, aiming to help me to understand and experiment with deep learning concepts. This release marks the first version of DeepLearningKit, but the journey doesn't end here! I'll be actively working on improving and expanding the library regularly. Stay tuned for updates and new features in future releases.

Getting Started:

  1. Installation:

    pip install deeplearningkit
    
  2. Usage:

     import deeplearningkit as nn
     import numpy as np
     from preprocess import preprocess_binary_output_data, create_data
    
     # Load and create synthetic data (not in the kit)
     (train_X, train_Y), (test_X, test_Y) = create_data(100, 2)
    
     # Define and compile the neural network model
     model = nn.Model()
     model.add(nn.Layer.Dense(train_X.shape[1], 24, nn.Initializer.HeUniform(train_X.shape[1])), nn.Activation.ReLU())
     model.add(nn.Layer.Dense(24, 24, nn.Initializer.HeUniform(24)), nn.Activation.ReLU())
     model.add(nn.Layer.Dense(24, 2, nn.Initializer.HeUniform(24)), nn.Activation.Softmax())
     model.compile(nn.Optimizer.Adam(), nn.Loss.CategoricalCrossEntropy())
    
     # Train the model
     model.fit(x=train_X, y=train_Y, batch_size=None, epochs=2001, shuffle=True, display=True, plot=False)
    
     # Evaluate the trained model
     model.evaluate(test_X, test_Y)
    
     # Alternatively, load data directly from a CSV file using a preprocessing function (not yet in the kit)
     (train_X, test_X), (train_Y, test_Y) = preprocess_binary_output_data("data.csv")
    
     # Define and compile the model using a simpler function call
     model = nn.Model()
     model.add(nn.Layer.layer("dense", train_X.shape[1], 24, nn.Initializer.initializer("Heuniform", train_X.shape[1])), nn.Activation.activation('relu'))
     model.add(nn.Layer.layer("dense", 24, 24, nn.Initializer.initializer("heuniform", 24)), nn.Activation.activation("ReLU"))
     model.add(nn.Layer.layer("dense", 24, 1, nn.Initializer.initializer("henormal", 24)), nn.Activation.activation("Sigmoid"))
     model.compile(nn.Optimizer.optimizer("adam"), nn.Loss.loss("BinaryCrossEntropy"))
    
     # Train the model
     model.fit(x=train_X, y=train_Y, batch_size=None, epochs=1001, shuffle=True, display=True, plot=False)
    
     # Evaluate the model
     model.evaluate(test_X, test_Y)
    
     # Load a model configuration from a JSON file
     model_data = nn.parse_model_json("model.json")
    
     # Compile and fit the model using parsed data and a specified data preprocessing function
     model: nn.Model = nn.compile_and_fit_parsed_model(model_data, preprocess_binary_output_data, display=True, plot=False)
     model.evaluate(test_X, test_Y)
    
     # Or load, compile, fit, and evaluate directly from a JSON configuration
     model_data = nn.parse_model_json("model.json")
     model: nn.Model = nn.compile_fit_evaluate_parsed_model(model_data, preprocess_binary_output_data, display=True, plot=False)
    
     # Example of JSON configuration for a neural network model
     # {
     #     "loss_function": "BinaryCrossEntropy",
     #     "layers": [
     #         {"type": "Dense", "units": 24, "activation": "ReLU", "weights_initializer": {"type": "heUniform", "params": {"n_inputs": 2}}},
     #         {"type": "Dense", "units": 24, "activation": "ReLU", "weights_initializer": {"type": "heUniform", "params": {"n_inputs": 24}}},
     #         {"type": "Dense", "units": 1, "activation": "Sigmoid", "weights_initializer": {"type": "xavier", "params": {"n_inputs": 24, "n_outputs": 1}}}
     #     ],
     #     "epochs": 1001,
     #     "batch_size": 0,
     #     "optimizer": {"type": "Adam", "params": {}},
     #     "data": "data.csv"
     # }
    

License: DeepLearningKit is licensed under the MIT License.

Acknowledgments: This project wouldn't have been possible without the support and guidance from the deep learning community, bigup to the book : 'Neural Network From Scratch' by Harrison Kinsley and Daniel Kukiela <3 . Let's continue to learn!

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

deeplearningkit-0.0.3.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

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

deeplearningkit-0.0.3-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file deeplearningkit-0.0.3.tar.gz.

File metadata

  • Download URL: deeplearningkit-0.0.3.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for deeplearningkit-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b16a2150abc5af5c380e31132f3b8bfc77c740c2ac631313d21c1ecb10a5eee1
MD5 59d4c7c00ebd3b60dd73bd0e7319ba59
BLAKE2b-256 9c46afe49c375e38e087a6f334b3d8e052a4e106cf75e9e7b73d2990476cce9c

See more details on using hashes here.

File details

Details for the file deeplearningkit-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for deeplearningkit-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7ecbc8e85a01fa4fdeca82ea47674b27fbaedcbbfaeed197dbcf4a0b221c6543
MD5 5688766803b266d8b13a8ca11fc4d6f1
BLAKE2b-256 0772d9775964c22200d3c8f03f48112f1926f9d8007f8d8274ef4f8197cec01e

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