Skip to content

Instantly share code, notes, and snippets.

View minesh1291's full-sized avatar
๐Ÿš–
On The Journey to Neverland

Minesh A. Jethva minesh1291

๐Ÿš–
On The Journey to Neverland
View GitHub Profile
@minesh1291
minesh1291 / convert_dataframe_to_dataset.py
Created June 23, 2020 13:08 — forked from ericness/convert_dataframe_to_dataset.py
Convert pandas DataFrame into TensorFlow Dataset
import numpy as np
import pandas as pd
import tensorflow as tf
tf.enable_eager_execution()
training_df: pd.DataFrame = pd.DataFrame(
data={
'feature1': np.random.rand(10),
'feature2': np.random.rand(10),
@minesh1291
minesh1291 / interpolator.py
Created June 24, 2020 02:01 — forked from ericness/interpolator.py
Interpolate a standardized time series.
import numpy as np
import pandas as pd
from scipy.interpolate import CubicSpline
def interpolate_time_series(time_series: pd.Series, n_points: int) -> pd.Series:
"""
Interpolate the pattern in the standardized time series data into `n_points`
number of values at equal intervals between 0 and 1.
@minesh1291
minesh1291 / tensorboard_example.py
Created June 28, 2020 19:44 — forked from fuatbeser/tensorboard_example.py
Tensorboard example in Google Colab.
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras import backend as K
from keras.callbacks import TensorBoard
batch_size = 128
@minesh1291
minesh1291 / tensorboard_in_colab.py
Created June 28, 2020 19:44 — forked from fuatbeser/tensorboard_in_colab.py
Run Tensorboard in Google Colab
# You can change the directory name
LOG_DIR = 'tb_logs'
!wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
!unzip ngrok-stable-linux-amd64.zip
import os
if not os.path.exists(LOG_DIR):
os.makedirs(LOG_DIR)
@minesh1291
minesh1291 / colab2drive.py
Created June 28, 2020 19:44 — forked from fuatbeser/colab2drive.py
Send large files from Google Colab to Google Drive.
# Which file to send?
file_name = "REPO.tar"
from googleapiclient.http import MediaFileUpload
from googleapiclient.discovery import build
auth.authenticate_user()
drive_service = build('drive', 'v3')
def save_file_to_drive(name, path):
@minesh1291
minesh1291 / release-sphinx-to-gcs.yml
Created July 2, 2020 23:58 — forked from c-bata/release-sphinx-to-gcs.yml
Github Actions Workflow to build your sphinx documentation and upload it to Google Cloud Storage.
name: release
on:
push:
branches:
- master
jobs:
release:
name: Build
runs-on: ubuntu-latest
@minesh1291
minesh1291 / iter-corpus-rosa.py
Created July 14, 2020 00:17 — forked from albertz/iter-corpus-rosa.py
LibriSpeech, demo MFCC extraction, analysis
#!/usr/bin/env python3
import os
import sys
from glob import glob
import librosa
import time
import numpy
numpy.random.seed(42)
@minesh1291
minesh1291 / librosa_parallel.py
Created July 15, 2020 23:19 — forked from tracek/librosa_parallel.py
Running librosa parallel for loops with multiprocessing and joblib
# The script illustartes stunning difference on my machine with processing of signal with multiprocessing and joblib.
# The slowness of multiprocessing is likely caused by oversubscription
import time
import numpy as np
import librosa
from joblib import Parallel, delayed
from functools import partial
from multiprocessing import Pool
@minesh1291
minesh1291 / stock_price_autoencoding.ipynb
Created July 25, 2020 04:47 — forked from GerardBCN/stock_price_autoencoding.ipynb
Stock market Bitcoin data compression with autoencoders
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@minesh1291
minesh1291 / sklearn-MAPE.py
Created October 1, 2020 12:17 — forked from amanahuja/sklearn-MAPE.py
Mean Absolute Percentage Error (MAPE) metric for python sklearn. Written in response to a question on Cross Validated: http://stats.stackexchange.com/questions/58391/mean-absolute-percentage-error-mape-in-scikit-learn/62511#62511
from sklearn.utils import check_arrays
def mean_absolute_percentage_error(y_true, y_pred):
"""
Use of this metric is not recommended; for illustration only.
See other regression metrics on sklearn docs:
http://scikit-learn.org/stable/modules/classes.html#regression-metrics
Use like any other metric
>>> y_true = [3, -0.5, 2, 7]; y_pred = [2.5, -0.3, 2, 8]