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
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() |
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
#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, |
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
#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, |
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
#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, |
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
#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, |
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
#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, |
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
def anagrams(s1,s2): | |
if len(s1) != len(s2): | |
return False | |
return sorted(s1) == sorted(s2) |
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
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 |
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
#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): |
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
#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 |
NewerOlder