Skip to content

Instantly share code, notes, and snippets.

View RahulDas-dev's full-sized avatar
🏠
Working from home

Rahul Das RahulDas-dev

🏠
Working from home
View GitHub Profile
@RahulDas-dev
RahulDas-dev / LinearRegrassion.ipynb
Last active October 26, 2024 06:30
Math behind the Linear Regression with Gradient Descent from scratch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@RahulDas-dev
RahulDas-dev / Gaussian Process.py
Last active September 16, 2024 13:15
Plot Samples from Gaussian distributations
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
from matplotlib.offsetbox import AnchoredText
from scipy import stats
from ipywidgets import interact
@RahulDas-dev
RahulDas-dev / pipeline.ipynb
Last active February 23, 2024 12:11
Scikit-Learn Pipe Line Building + Optuna Search cv + Joblib Memory
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@RahulDas-dev
RahulDas-dev / manage_python.md
Last active January 13, 2024 07:55
Manage Multiple Python in Windows [ With out Conda ]

Managing Multiple Python Versions in Windows Terminal

This is a useful approach for switching between Python versions easily. I've organized the steps for better clarity:

Step 1: Remove Python Paths from PATH Variable.

Remove all existing Python installation paths from the system path and your accounts path variable.

Step 2: Create Bat Files for Each Python Version.

Create a bat file (e.g., python_39.bat) for each Python version.

@RahulDas-dev
RahulDas-dev / pydantic_2_sqlalchemy_2_pydantic.md
Last active November 5, 2023 07:10
Save or Load Complex nested Pydantic model into or from sqlalclemy-fileds

Save or Load Complex nested Pydantic model into or from sqlalclemy-fileds

This gist demonstrates a custom SQLAlchemy column type that allows you to save and load Pydantic models directly in your SQLAlchemy database. It simplifies the process of storing and retrieving complex pydantic data models in your database without manual conversion to JSON or dictionaries.

kindly Check Git Repo or follow steps bellow

Steps

  1. Building custom Column Type
  2. Building a nested data structure using Pydantic model
  3. Building a Sqlalchemy Table models using 1 and 2

‼️ Links to Useful Books on Rust + List of Useful Resources for Learning Rust

Copied from Udemy Course Rust Programming Course: From Beginner to Expert by Nouman Azam 😉

🦀 Resources Covering Basic Concepts of the Language 🦀

  1. Rust Programming Language,
@RahulDas-dev
RahulDas-dev / Sklearn_Pipeline.md
Created July 31, 2023 20:38
A Simple Scikit-learn Pipeline

Loading dataset

import pandas as pd
from sklearn.datasets import  fetch_openml

x = fetch_openml(data_id=1461, as_frame=True, parser='pandas') 
dataset = x['frame']
print(f'dataset Shape {dataset.shape}')
dataset.head()
@RahulDas-dev
RahulDas-dev / Pycaret.ipynb
Last active June 17, 2023 06:23
Pycaret.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@RahulDas-dev
RahulDas-dev / matrix_factorization.py
Created February 14, 2023 19:45
matrix factorization using gradient descent
import numpy as np
# Frobenius norm (X) = Tr(X.X_T) X_T = Transpose of X
# d(Frobenius norm)/dX = 2X
# M ~ L*R
# R = l*r - M
# Loss_fuction = NORM(R) to be minimized
# Loss_fuction = NORM(R)
@RahulDas-dev
RahulDas-dev / gradient_descent.py
Last active February 2, 2023 14:28
Gradient Descend implementation , Finding minimum of Loss Function , Loss Function Optimization
import numpy as np
### Loss function : L(w₁,w₂) = 0.75(w₁ −2)² + 0.35(w₂−4)²
### Gradient of Loss function : ∇ L = [0.75×2×(w₁ −2), 0.35×2×(w₂−4)]ᵀ
### Hyper Parameters : Learning Rate η = 0.1 , iteration or epoch N = 100
loss_f = lambda w1,w2: 0.75*(w1-2)**2 + 0.35*(w2-4)**2
grad_f = lambda w1,w2: np.array([1.5*(w1-2),0.7*(w2-4)])
eta, epoch = 0.1 ,100