Skip to content

Instantly share code, notes, and snippets.

@theibrr
theibrr / lstm.py
Created December 6, 2021 20:53
Exploratory Data Analysis of Stock Price and Predicting the Price using LSTM(RNN) and DNN
# -*- coding: utf-8 -*-
"""
@author: Ibrahim Kovan
https://ibrahimkovan.medium.com/
"""
""" [1] """
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
@theibrr
theibrr / poisson.py
Created November 10, 2021 14:17
poisson distribution
"""
@author: Ibrahim Kovan
License CC0: Public Domain
https://ibrahimkovan.medium.com/
"""
import numpy as np
import matplotlib.pyplot as plt
import math
import pandas as pd
"1"
@theibrr
theibrr / poisson.py
Created November 10, 2021 14:06
poisson distribution
"""
@author: Ibrahim Kovan
https://ibrahimkovan.medium.com/
"""
import numpy as np
import matplotlib.pyplot as plt
import math
X = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
@theibrr
theibrr / poisson.py
Created November 10, 2021 13:59
poisson distribution
"""
@author: Ibrahim Kovan
https://ibrahimkovan.medium.com/
"""
from scipy.stats import poisson
import numpy as np
import matplotlib.pyplot as plt
X = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
lmbda = 4.6
@theibrr
theibrr / isomap.py
Created October 24, 2021 22:39
Preserving Geodesic Distance for non-linear datasets: ISOMAP
import matplotlib.pyplot as plt
from matplotlib.offsetbox import AnnotationBbox
from matplotlib import offsetbox
import tensorflow as tf
from sklearn.manifold import Isomap
from sklearn.datasets import fetch_openml
mnist = fetch_openml('mnist_784')
data = mnist.data[mnist.target == "9"][::10]
def plot_components(data, model, images=None, ax=None,
@theibrr
theibrr / isomap.py
Created October 24, 2021 22:38
Preserving Geodesic Distance for non-linear datasets: ISOMAP
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import load_digits
from sklearn.manifold import Isomap
from matplotlib.offsetbox import AnnotationBbox
from matplotlib import offsetbox
from sklearn.datasets import fetch_openml
from sklearn.datasets import fetch_lfw_people
faces = fetch_lfw_people(min_faces_per_person=40)
@theibrr
theibrr / isomap.py
Created October 24, 2021 22:27
Preserving Geodesic Distance for non-linear datasets: ISOMAP
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_swiss_roll
X, color = make_swiss_roll(n_samples=1000, random_state=2021)
fig = plt.figure(figsize=(16,8))
ax = fig.add_subplot(111, projection='3d')
ax.scatter(X[:, 0], X[:, 1], X[:, 2], c=color, cmap=plt.cm.rainbow)
@theibrr
theibrr / mds.py
Created October 12, 2021 21:20
MDS
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import load_digits
digits = load_digits(n_class=5)
x, y = digits.data, digits.target
def plot_digits(X,title):
with plt.style.context(("seaborn", "ggplot")):
colors = ['red','green','orange','blue','purple','cyan','magenta', 'firebrick','indigo']
@theibrr
theibrr / mds.py
Created October 12, 2021 21:18
MDS
from sklearn.datasets import make_s_curve
import pandas as pd
import matplotlib.pyplot as plt
x, y = make_s_curve(n_samples=1000)
from sklearn.manifold import MDS
mds = MDS(n_components=2)
x_mds = mds.fit_transform(x)
@theibrr
theibrr / mds.py
Created October 12, 2021 21:13
MDS
import seaborn as sns
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.manifold import MDS
from sklearn.datasets import fetch_olivetti_faces
faces = fetch_olivetti_faces()
x_faces = faces.data