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 get_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 in the kit)
     (train_X, test_X), (train_Y, test_Y) = get_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, get_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, get_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.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.

deeplearningkit-0.0.2-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deeplearningkit-0.0.2.tar.gz
  • Upload date:
  • Size: 9.9 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.2.tar.gz
Algorithm Hash digest
SHA256 54eedbc971e03df769f1fc6d34209b86af34bf7c7a11fbac9e7f64619e00d16f
MD5 5d1bbe3e974f029a05a515ac61cac690
BLAKE2b-256 406de6f6837f1e16b9ec8b654a048508604049ece259e2600f292c92fafe598c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for deeplearningkit-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8617394b708c4b7e4c38cd652274feb83cf30c901c925627b6e166cc07531bb3
MD5 42017a736bb9631f6ca9be099ccf9e87
BLAKE2b-256 8448233a3912fc158b1d835185083af7d0310fe5ec20d507a46a5d576a3883d1

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