-
Notifications
You must be signed in to change notification settings - Fork 55
Implementing an AND Gate Using a Simple Neural Network #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
144 changes: 144 additions & 0 deletions
144
docs/projects/deep-learning/and-gate-using-neural-network.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| # 📜 AND Gate Implementation Using a Simple Neural Network | ||
|
|
||
| <div align="center"> | ||
| <img src="https://www.symbols.com/images/symbol/1/1729_and-gate.png" /> | ||
| </div> | ||
|
|
||
| ## 🎯 AIM | ||
| To develop a simple neural network that mimics the behavior of an AND gate using a perceptron model. | ||
|
|
||
|
|
||
| ## 📊 DATASET LINK | ||
| NOT USED | ||
|
|
||
|
|
||
| ## 📓 KAGGLE NOTEBOOK | ||
| <!-- Attach both links Kaggle URL/ Embed URL public notebook link. --> | ||
| [https://www.kaggle.com/code/thatarguy/and-gate-using-simple-neural-network](https://www.kaggle.com/code/thatarguy/and-gate-using-simple-neural-network) | ||
|
|
||
| ??? Abstract "Kaggle Notebook" | ||
|
|
||
| <iframe | ||
| src="https://www.kaggle.com/code/thatarguy/and-gate-using-simple-neural-network" | ||
| height="600" | ||
| style="margin: 0 auto; width: 100%; max-width: 950px;" | ||
| frameborder="0" | ||
| scrolling="auto" | ||
| title="cvd-risk-prediction-system"> | ||
| </iframe> | ||
|
|
||
| ## ⚙️ TECH STACK | ||
|
|
||
| | **Category** | **Technologies** | | ||
| |--------------------------|---------------------------------------------| | ||
| | **Languages** | Python | | ||
| | **Libraries/Frameworks** | TensorFlow, Keras, Numpy, Matplotlib | | ||
| | **Tools** | Kaggle, Jupyter, | | ||
|
|
||
| --- | ||
|
|
||
| ## 📝 DESCRIPTION | ||
| !!! info "What is the requirement of the project?" | ||
| - Develop a minimal neural network that performs binary classification. | ||
| - Train a perceptron to correctly compute the AND logic operation. | ||
|
|
||
|
|
||
| ??? info "How is it beneficial and used?" | ||
| - Demonstrates how logic gates can be implemented using machine learning. | ||
| - Forms a foundation for more complex deep learning projects. | ||
|
|
||
| ??? info "How did you start approaching this project? (Initial thoughts and planning)" | ||
| - Explored TensorFlow/Keras for implementing simple models. | ||
| - Designed a neural network with a single-layer perceptron. | ||
|
|
||
| ??? info "Mention any additional resources used (blogs, books, chapters, articles, research papers, etc.)." | ||
| - TensorFlow and Keras documentation. | ||
|
|
||
|
|
||
| --- | ||
|
|
||
| ## 🔍 PROJECT EXPLANATION | ||
|
|
||
| ### 🛤 PROJECT WORKFLOW | ||
| <!-- Draft a visualization graph of your project workflow using mermaid --> | ||
|
|
||
| !!! success "Project workflow" | ||
|
|
||
| ``` mermaid | ||
| graph LR | ||
| A[Start] --> C[Create Perceptron Model] | ||
| C --> D[Train the Model] | ||
| D --> E[Evaluate Performance] | ||
| E --> F[End] | ||
| ``` | ||
|
|
||
| <!-- Clearly define the step-by-step workflow followed in the project. You can add or remove points as necessary. --> | ||
| === "Step 1" | ||
| - Define the input-output pairs for the AND gate. | ||
|
|
||
| === "Step 2" | ||
| - Implement a single-layer perceptron model. | ||
|
|
||
| === "Step 3" | ||
| - Train the model using supervised learning with gradient descent. | ||
|
|
||
| === "Step 4" | ||
| - Evaluate the model's accuracy in predicting AND gate outputs. | ||
|
|
||
| === "Step 5" | ||
| - Test the trained model with different inputs. | ||
|
|
||
|
|
||
|
|
||
| --- | ||
|
|
||
| ### 🖥 CODE EXPLANATION | ||
| === "Perceptron Model" | ||
| - Implemented using NumPy and TensorFlow/Keras. | ||
| - Uses a single-layer neural network with sigmoid activation. | ||
|
|
||
|
|
||
| --- | ||
|
|
||
| ### ⚖️ PROJECT TRADE-OFFS AND SOLUTIONS | ||
| === "Trade Off 1" | ||
| - Accuracy vs. Simplicity: A single-layer perceptron is sufficient for the AND gate but cannot handle more complex problems like XOR. | ||
| - Solution: Use multi-layer perceptrons for non-linearly separable problems. | ||
| --- | ||
|
|
||
| ## 🖼 SCREENSHOTS | ||
|
|
||
| !!! example "Model performance graphs" | ||
|
|
||
| === "Training Progress" | ||
|  | ||
|
|
||
| --- | ||
|
|
||
| ## 📉 MODELS USED AND THEIR EVALUATION METRICS | ||
| <!-- Summarize the models used and their evaluation metrics in a table. --> | ||
|
|
||
| | Model | Accuracy | | ||
| |------------|----------| | ||
| | Perceptron | 100% | | ||
|
|
||
| --- | ||
|
|
||
| ## ✅ CONCLUSION | ||
|
|
||
| ### 🔑 KEY LEARNINGS | ||
| !!! tip "Insights gained from the data" | ||
| - Understanding of perceptrons and logic gates.- Implementing simple neural networks. | ||
|
|
||
| ??? tip "Improvements in understanding machine learning concepts" | ||
| - Learned about activation functions and training neural networks. | ||
|
|
||
| --- | ||
|
|
||
| ### 🌍 USE CASES | ||
|
|
||
| === "Simple AI Applications" | ||
| - Basic logic implementations in AI systems. | ||
|
|
||
| === "Introduction to Neural Networks" | ||
| - A stepping stone to more advanced ML applications. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.kaggle.com/embed/thatarguy/and-gate-using-simple-neural-network?kernelSessionId=221232618