Skip to main content

Perceptron

References

CI/CD.yml code

# name of the workflow
name: Upload Python Package

#when to execute - when you push changes on "main" branch
on:
  push:
    branches:
    - main
    # - dev  => add for more branches if needed

# what to execute - lists jobs
jobs:
  deploy: # first job ,you can list more jobs as well
    runs-on: ubuntu-latest # CREATE UBUNTU ENVIRONMENT
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python  #sets up python
        uses: actions/setup-python@v2
        with:
          python-version: '3.7'  # python version needed
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install build
      - name: Build package
        run: python -m build
      - name: Publish package
        uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
        with:
          user: __token__
          password: ${{ secrets.PYPI_API_TOKEN }}

        

How to use package

from perceptron_package.perceptron_class import Perceptron 
import pandas as pd

def prepare_data(df):
  """ Used to separate dependent and independent features       

  Args:
      df (pd.dataframe): pandas dataframe

  Returns:
      tuple: returns tuple of dependent & independent variables
  """
  X = df.drop("y",axis=1)
  y = df["y"]
  return X,y



def main(data ,eta,epochs):
       df = pd.DataFrame(data)
       df  # Shape = (4,3)

       X,y = prepare_data(df) 

       model = Perceptron(eta=eta, epochs=epochs)  # Creating object of class Perceptron
       model.fit(X, y) # Weights in last epoch are considered as final weights for prediction

       _ = model.total_loss() # last Epoch's Sum of Errors , '_' indicates dummy variable

       
if __name__ == '__main__': # define entry point of program execution
       AND = {"x1":[0,0,1,1],
              "x2":[0,1,0,1],
              "y" :[0,0,0,1]
              }

       ETA = 0.3 # between 0 and 1
       EPOCHS = 10
       main(AND,ETA,EPOCHS)
      

Release files for Perceptron-RabiaWadhwa 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Perceptron-RabiaWadhwa 0.0.2
File Size Uploaded
Perceptron-RabiaWadhwa-0.0.2.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Perceptron-RabiaWadhwa 0.0.2
File Interpreter ABI Platform
Perceptron_RabiaWadhwa-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / Perceptron-RabiaWadhwa-0.0.2.tar.gz

Download URL Perceptron-RabiaWadhwa-0.0.2.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d23c917b6024d6d2a0f5eb440d64b1d1a5555e9b813c711e2a4a9479b83d0285
BLAKE2b-256 checksum
How to use checksums
51e46e406b46d2a7fdf8a12dedfa85529c8b09905cde32b589b318499296f48e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / Perceptron_RabiaWadhwa-0.0.2-py3-none-any.whl

Download URL Perceptron_RabiaWadhwa-0.0.2-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
161f67cead4c5ec1ab1a54f584091f135ec35c1868907a860d4e7469b73ec9d4
BLAKE2b-256 checksum
How to use checksums
d7b2613b8f335315e35d86a2f0b1a0611c6506703e1341a7d56b6dc04afa46db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page