Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍🎓
Full time student

K. Ali Pardhan alik604

👨‍🎓
Full time student
View GitHub Profile
View Local_setup.md

Python & Machine Learning Hello world

Quickly get up to speed

Software setup

Use Python 3.8.*. No point in 3.9, however it should be fine.

Run these to test if install is successful, and install some important packages. Please follow the errors as they come, one will ask the user to install C++ build tools, if not already installed (see below). This will take several minutes, as the dependencies are a few GBs. You must be off VPN, or set-proxy, as shown below.

@alik604
alik604 / starred repo opener.py
Last active Mar 11, 2021
Open all starred GitHub repositories in new tab - Open every starred GitHub repo in chrome, with python
View starred repo opener.py
import requests
import json
import webbrowser
USER = "alik604"
chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
# Change to your OS - https://stackoverflow.com/a/24353812/5728614
req = requests.get('https://api.github.com/users/' + USER + '/starred?per_page=100')
# ?page=2&per_page=100 # page is not working, first result is always the same
@alik604
alik604 / Fourier_Extrapolation.py
Last active Aug 24, 2020 — forked from tartakynov/fourex.py
Fourier Extrapolation in Python
View Fourier_Extrapolation.py
import numpy as np
import pylab as pl
from numpy import fft
def fourierExtrapolation(x, n_predict):
n = x.size
n_harm = 10 # number of harmonics in model
t = np.arange(0, n)
p = np.polyfit(t, x, 1) # find linear trend in x
View mnist - get data.py
!pip install mnist
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import metrics
import mnist
# from hmmlearn.hmm import GaussianHMM, MultinomialHMM
X_train = mnist.train_images()
View url_parser.py
import urllib.parse as parse
url = ""
if 'url' not in globals():
print("Enter URL to parse")
url = input()
def printDict(data):
for x in data:
@alik604
alik604 / build_dataset LSTM.py
Created Jul 28, 2020
build_dataset LSTM.py
View build_dataset LSTM.py
# make dataset to input
def build_dataset(time_series, seq_length):
dataX = []
dataY = []
for i in range(0, len(time_series) - seq_length):
_x = time_series[i:i + seq_length, :]
_y = time_series[i + seq_length, [-1]] # Next close price
print(_x, "->", _y)
dataX.append(_x)
dataY.append(_y)
@alik604
alik604 / visualizing data in 2d and 3d.py
Last active Jul 4, 2020
Quickly visualize your data in 2d and 3d with PCA and TSNE (t-sne)
View visualizing data in 2d and 3d.py
# imports from matplotlib import pyplot as plt
from matplotlib import pyplot as plt
import pylab
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d import proj3d
%matplotlib inline
%pylab inline
from sklearn.manifold import TSNE
from sklear.decomposition import PCA
@alik604
alik604 / boilerplate.py
Last active Jul 1, 2020
boiler plate for jupyter notebook on Data Science or Machine Learning
View boilerplate.py
%%capture
!pip install scikit-plot
!pip install catboost
!pip install mlxtend
!pip install yfinance
!pip install pyod
import pyod
import yfinance
import xgboost # xgboost.readthedocs.io/en/latest/python/python_api.html#xgboost.XGBClassifier
View numba_absolute_minimum.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alik604
alik604 / OpenCV_Image_Augmentation.py
Created Jun 4, 2020
Image augmentation by mirroring, random rotation, shifts, shear and flips, etc.
View OpenCV_Image_Augmentation.py
# @credit - kaggle.com/hanzh0420/image-augmentation-with-opencv
import os
print(os.listdir("../input"))
# Input data files are available in the "../input/" directory.
# Any results you write to the current directory are saved as output.
import numpy as np
#import pandas as pd # pd.read_csv
import cv2
import random