Skip to content

Instantly share code, notes, and snippets.

View sahasourav17's full-sized avatar
🎯
Focusing

Sourav Saha sahasourav17

🎯
Focusing
View GitHub Profile
from typing import Union
import uvicorn
import numpy as np
import pandas as pd
import pickle as pk
from sklearn.linear_model import LogisticRegression
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
#importing required libraries
from scipy.stats import poisson
import seaborn as sns
import matplotlib.pyplot as plt
#creating the Poisson distribution
data = poisson.rvs(mu=3, size=10000,random_state = 93)
#plotting the data
ax = sns.distplot(data,
#importing required libraries
from scipy.stats import binom
import seaborn as sns
import matplotlib.pyplot as plt
#creating the binomial distribution
data = binom.rvs(n=20,p=0.7,size=10000)
#plotting the data
ax = sns.distplot(data,
#importing required libraries
from scipy.stats import expon
import seaborn as sns
import matplotlib.pyplot as plt
#creating the exponential distribution
data = expon.rvs(loc=0,scale=10,size=10000)
#plotting the data
ax = sns.distplot(data,
#importing required libraries
from scipy.stats import norm
import seaborn as sns
import matplotlib.pyplot as plt
#creating the normal distribution
data = norm.rvs(size=10000,loc=0,scale=1)
#plotting the data
ax = sns.distplot(data,
#import uniform distribution
from scipy.stats import uniform
import seaborn as sns
import matplotlib.pyplot as plt
#taking random variables from uniform distribution
data = uniform.rvs(size = 10000,loc = 5,scale = 10)
#plotting the uniform data
ax = sns.distplot(data,
def anagrams(s1,s2):
if len(s1) != len(s2):
return False
return sorted(s1) == sorted(s2)
from collections import Counter
def anagrams(s1,s2):
"""
As seen in method 2, we first check if both strings have the
same length because if they're not it's impossible for them
to be anagrams.
"""
if len(s1) != len(s2):
return False
#Function to check two strings are anagrams or not
def anagrams(s1,s2):
"""
we first check if both strings have the same length
because if they're not it's impossible for them to
be anagrams.
"""
if len(s1) != len(s2):
#import needed libraries
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import numpy as np
import matplotlib.pyplot as plt
#set the hyper-parameters
learning_rate = 0.001
training_epochs = 1000