Skip to content

Commit

Permalink
Merge branch 'Avdhesh-Varshney:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
bhanushri12 authored Jun 10, 2024
2 parents e070c61 + 8cbc5b6 commit 1450679
Show file tree
Hide file tree
Showing 30 changed files with 1,979 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug Report 🐞
about: Reporting for any bug in the project description or algorithm description.
title: '🐛: '
labels: ["Up-for-Grabs ✋", "bug 🐛"]
assignees:
- ''

---

:red_circle: **Title** :
:red_circle: **Bug** :
:red_circle: **Changes** : <!-- Explain the approach to handle this bug. -->


### Screenshots 📷
<!-- Write N/A if not available-->


***********************************************************************
:white_check_mark: **To be Mentioned while taking the issue :**
- Full name :
- What is your participant role? (Mention the Open Source Program name. Eg. GSOC, GSSOC, SSOC, JWOC, etc.)

***********************************************************************
Happy Contributing 🚀

All the best. Enjoy your open source journey ahead. 😎
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Questions
url: https://discord.gg/tSqtvHUJzE
about: You can join the discussions on Discord.
- name: Login does not work
url: https://github.com/Avdhesh-Varshney/AI-Code/blob/main/README.md
about: Before opening a new issue, please make sure to read README.md
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Enhancement Request 🧑‍💻
about: Improving any styling or documentation of the project/algorithm
title: '🧑‍💻: '
labels: ["Up-for-Grabs ✋", "enhancement 🧑‍💻"]
assignees:
- ''

---

:red_circle: **Title** :
:red_circle: **Enhancement Aim** :
:red_circle: **Changes** : <!-- Enlist those changes you want to do. -->


### Screenshots 📷
<!-- Write N/A if not available-->


***********************************************************************
:white_check_mark: **To be Mentioned while taking the issue :**
- Full name :
- What is your participant role? (Mention the Open Source Program name. Eg. GSOC, GSSOC, SSOC, JWOC, etc.)

***********************************************************************
Happy Contributing 🚀

All the best. Enjoy your open source journey ahead. 😎
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/project-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Code Addition Request 📜
about: Requesting for the new project/algorithm addition to contribute in this repository.
title: '📃: '
labels: 'Up-for-Grabs ✋'
assignees:
- ''

---

:red_circle: **Title** :
:red_circle: **Aim** :
:red_circle: **Brief Explanation** :


### Screenshots 📷
<!-- Write N/A if not available-->


***********************************************************************
:white_check_mark: **To be Mentioned while taking the issue :**
- Full name :
- What is your participant role? (Mention the Open Source Program name. Eg. GSOC, GSSOC, SSOC, JWOC, etc.)

***********************************************************************
Happy Contributing 🚀

All the best. Enjoy your open source journey ahead. 😎
52 changes: 52 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Closes: <!-- #issue number -->

- **Title** :
- **Name:** <!--Mention Your name-->
- **Idenitfy yourself:** <!-- Mention your role (like GSOC, GSSOC, SSOC, etc. Contributor) -->


<!-- Mention the following details and these are mandatory -->

### Describe the add-ons or changes you've made 📃

Give a clear description of what have you added or modifications made


### Type of change ☑️
<!-- Please delete options that are not relevant. -->
What sort of change have you made:
<!--
Example how to mark a checkbox:-
- [x] My code follows the code style of this project.
-->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Code style update (formatting, local variables)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

### How Has This Been Tested? ⚙️
<!-- Describe how it has been tested
Describe how have you verified the changes made -->



### Checklist: ☑️
<!--
Example how to mark a checkbox:-
- [x] My code follows the code style of this project.
-->
- [ ] My code follows the [Contributing Guidelines](https://github.com/Avdhesh-Varshney/AI-Code/blob/main/README.md) & [Code of Conduct](https://github.com/Avdhesh-Varshney/AI-Code/blob/main/CODE_OF_CONDUCT.md) of this project.
- [ ] This PR does not contain plagiarized content.
- [ ] I have performed a self-review of my own code.
- [ ] I have commented my code, particularly wherever it was hard to understand.
- [ ] My changes generate no new warnings.


### Screenshots 📷
<!-- Must add the screenshot of the project or your changes for review your pr -->


### Note to reviewers 📄
<!-- Add notes to reviewers if applicable -->

36 changes: 36 additions & 0 deletions .github/workflows/auto-comment-pr-raise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Auto Comment on PR

on:
pull_request_target:
types: [opened]

permissions:
issues: write
pull-requests: write

jobs:
comment:
runs-on: ubuntu-latest

steps:
- name: Add Comment to Pull Request
run: |
COMMENT=$(cat <<EOF
{
"body": "Thank you for submitting your pull request! We'll review it as soon as possible. For further communication, join our discord server https://discord.gg/tSqtvHUJzE."
}
EOF
)
RESPONSE=$(curl -s -o response.json -w "%{http_code}" \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d "$COMMENT")
cat response.json
if [ "$RESPONSE" -ne 201 ]; then
echo "Failed to add comment"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Empty file added AI/Projects/.gitkeep
Empty file.
34 changes: 34 additions & 0 deletions AI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<h2>Hey <𝚌𝚘𝚍𝚎𝚛𝚜/>! 👋</h2>

## Available Algorithms

- A diverse collection of algorithms, each with clear explanations, test cases and practical examples.

| S.No | Algorithm | S.No. | Algorithm | S.No. | Algorithm |
|-------|-----------|-------|-----------|-------|-----------|
| 1 | | 2 | | 3 | |
| 4 | | 5 | | 6 | |

## Available Documentations

- Detailed guides and tutorials on various topics. These resources are designed to assist both beginners and advanced learners in understanding complex concepts and implementing AI solutions.

| S.No | Documentation | S.No | Documentation | S.No | Documentation |
|-------|---------------|-------|---------------|------|---------------|
| 1 | | 2 | | 3 | |
| 4 | | 5 | | 6 | |

## Available Projects

- A variety of projects to demonstrate real-world applications of AI algorithms. These projects include datasets, code, and step-by-step explanations to help users apply their knowledge and develop practical skills.

| S.No | Project | S.No | Project | S.No | Project |
|-------|---------|-------|---------|------|---------|
| 1 | | 2 | | 3 | |
| 4 | | 5 | | 6 | |


<div align="center">
<h3>Show some &nbsp;❤️&nbsp; by &nbsp;🌟&nbsp; this repository!</h3>
</div>
<a href="#top"><img src="https://img.shields.io/badge/-Back%20to%20Top-red?style=for-the-badge" align="right"/></a>
Empty file added DL/Projects/.gitkeep
Empty file.
34 changes: 34 additions & 0 deletions DL/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<h2>Hey <𝚌𝚘𝚍𝚎𝚛𝚜/>! 👋</h2>

## Available Algorithms

- A diverse collection of algorithms, each with clear explanations, test cases and practical examples.

| S.No | Algorithm | S.No. | Algorithm | S.No. | Algorithm |
|-------|-----------|-------|-----------|-------|-----------|
| 1 | | 2 | | 3 | |
| 4 | | 5 | | 6 | |

## Available Documentations

- Detailed guides and tutorials on various topics. These resources are designed to assist both beginners and advanced learners in understanding complex concepts and implementing AI solutions.

| S.No | Documentation | S.No | Documentation | S.No | Documentation |
|-------|---------------|-------|---------------|------|---------------|
| 1 | | 2 | | 3 | |
| 4 | | 5 | | 6 | |

## Available Projects

- A variety of projects to demonstrate real-world applications of AI algorithms. These projects include datasets, code, and step-by-step explanations to help users apply their knowledge and develop practical skills.

| S.No | Project | S.No | Project | S.No | Project |
|-------|---------|-------|---------|------|---------|
| 1 | | 2 | | 3 | |
| 4 | | 5 | | 6 | |


<div align="center">
<h3>Show some &nbsp;❤️&nbsp; by &nbsp;🌟&nbsp; this repository!</h3>
</div>
<a href="#top"><img src="https://img.shields.io/badge/-Back%20to%20Top-red?style=for-the-badge" align="right"/></a>
Empty file added GAN/Projects/.gitkeep
Empty file.
34 changes: 34 additions & 0 deletions GAN/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<h2>Hey <𝚌𝚘𝚍𝚎𝚛𝚜/>! 👋</h2>

## Available Algorithms

- A diverse collection of algorithms, each with clear explanations, test cases and practical examples.

| S.No | Algorithm | S.No. | Algorithm | S.No. | Algorithm |
|-------|-----------|-------|-----------|-------|-----------|
| 1 | | 2 | | 3 | |
| 4 | | 5 | | 6 | |

## Available Documentations

- Detailed guides and tutorials on various topics. These resources are designed to assist both beginners and advanced learners in understanding complex concepts and implementing AI solutions.

| S.No | Documentation | S.No | Documentation | S.No | Documentation |
|-------|---------------|-------|---------------|------|---------------|
| 1 | | 2 | | 3 | |
| 4 | | 5 | | 6 | |

## Available Projects

- A variety of projects to demonstrate real-world applications of AI algorithms. These projects include datasets, code, and step-by-step explanations to help users apply their knowledge and develop practical skills.

| S.No | Project | S.No | Project | S.No | Project |
|-------|---------|-------|---------|------|---------|
| 1 | | 2 | | 3 | |
| 4 | | 5 | | 6 | |


<div align="center">
<h3>Show some &nbsp;❤️&nbsp; by &nbsp;🌟&nbsp; this repository!</h3>
</div>
<a href="#top"><img src="https://img.shields.io/badge/-Back%20to%20Top-red?style=for-the-badge" align="right"/></a>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import numpy as np

class ElasticNetRegression:
def __init__(self, alpha=1.0, l1_ratio=0.5, max_iter=1000, tol=1e-4):
self.alpha = alpha
self.l1_ratio = l1_ratio
self.max_iter = max_iter
self.tol = tol
self.coef_ = None
self.intercept_ = None

def fit(self, X, y):
n_samples, n_features = X.shape
self.coef_ = np.zeros(n_features)
self.intercept_ = 0
learning_rate = 0.01

for iteration in range(self.max_iter):
y_pred = np.dot(X, self.coef_) + self.intercept_
error = y - y_pred

gradient_w = (-2 / n_samples) * (X.T.dot(error)) + self.alpha * (self.l1_ratio * np.sign(self.coef_) + (1 - self.l1_ratio) * 2 * self.coef_)
gradient_b = (-2 / n_samples) * np.sum(error)

new_coef = self.coef_ - learning_rate * gradient_w
new_intercept = self.intercept_ - learning_rate * gradient_b

if np.all(np.abs(new_coef - self.coef_) < self.tol) and np.abs(new_intercept - self.intercept_) < self.tol:
break

self.coef_ = new_coef
self.intercept_ = new_intercept

def predict(self, X):
return np.dot(X, self.coef_) + self.intercept_
47 changes: 47 additions & 0 deletions ML/Algorithms/Regressions/ElasticNetRegression/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Elastic Net Regression

This module contains an implementation of Elastic Net Regression, a powerful linear regression technique that combines both L1 (Lasso) and L2 (Ridge) regularization. Elastic Net is particularly useful when dealing with high-dimensional datasets and can effectively handle correlated features.

## Usage

To use Elastic Net Regression, follow these steps:

1. Import the ElasticNetRegression class.
2. Create an instance of the class, specifying parameters such as the regularization strength (alpha), the ratio between L1 and L2 regularization (l1_ratio), the maximum number of iterations (max_iter), and the tolerance (tol).
3. Fit the model to your training data using the fit method.
4. Make predictions using the predict method.

## Parameters

- `alpha`: The regularization strength. A positive float value.
- `l1_ratio`: The ratio of L1 regularization to L2 regularization. Should be between 0 and 1.
- `max_iter`: The maximum number of iterations to run the optimization algorithm.
- `tol`: The tolerance for the optimization. If the updates are smaller than this value, the optimization will stop.

## Installation

To use this module, make sure you have the required dependencies installed:

```bash
pip install numpy
```

#### Getting Started

To run the Elastic Net Regression module and the tests, use the following commands:

```bash
python3 ElasticNetRegression.py
python3 test.py
```
#### Output

<img width="447" alt="Screenshot 2024-06-02 at 5 23 15 PM" src="https://github.com/KamakshiOjha/AI-Code/assets/114620432/902c498d-8eec-4c51-9f0d-284c8c430386">



## Coded By

[Kamakshi Ojha](https://github.com/KamakshiOjha)

### Happy Coding 👦
Loading

0 comments on commit 1450679

Please sign in to comment.