Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Jaganadh Gopinadhan jaganadhg

🎯
Focusing
View GitHub Profile
@jaganadhg
jaganadhg / explore_tar.py
Last active May 9, 2020
Tar File Explororo
View explore_tar.py
import tarfile
def get_file_match_patterns(tar_file_path : str, pattern : str) -> int:
"""
Count number of file containing pattern in a tar file without extract.
:params tar_file_path: Absolute path to tar file
:params pattern: patterns to searh in the file names
:returns count_matching: Count of matching files
"""
tar_content = tarfile.open(tar_file_path)
View regexmatch.py
import re
from collections import Counter
data = ["/mnt/volume1/vol/img.img","/mnt/volume1/some.img","/mnt/volume2/simg.img"]
def match_volume(input_data,search_patten):
regex_patt = re.compile(search_patten)
macthed_gen = [regex_patt.search(inp) for inp in input_data]
match_count = Counter(mtch.group() for mtch in macthed_gen if mtch)
return match_count
View get_color_code.py
from sklearn.cluster import KMeans
from sklearn import metrics
import cv2
# By Adrian Rosebrock
import numpy as np
import cv2
# Load the image
image = cv2.imread("red.png")
@jaganadhg
jaganadhg / elastic_transform.py
Created May 18, 2017 — forked from chsasank/elastic_transform.py
Elastic transformation of an image in Python
View elastic_transform.py
import numpy as np
from scipy.ndimage.interpolation import map_coordinates
from scipy.ndimage.filters import gaussian_filter
def elastic_transform(image, alpha, sigma, random_state=None):
"""Elastic deformation of images as described in [Simard2003]_.
.. [Simard2003] Simard, Steinkraus and Platt, "Best Practices for
Convolutional Neural Networks applied to Visual Document Analysis", in
View something2vec.list
- word2vec https://arxiv.org/abs/1310.4546
- sentence2vec, paragraph2vec, doc2vec http://arxiv.org/abs/1405.4053
- tweet2vec http://arxiv.org/abs/1605.03481
- tweet2vec https://arxiv.org/abs/1607.07514
- author2vec http://dl.acm.org/citation.cfm?id=2889382
- item2vec http://arxiv.org/abs/1603.04259
- lda2vec https://arxiv.org/abs/1605.02019
- illustration2vec http://dl.acm.org/citation.cfm?id=2820907
- tag2vec http://ktsaurabh.weebly.com/uploads/3/1/7/8/31783965/distributed_representations_for_content-based_and_personalized_tag_recommendation.pdf
- category2vec http://www.anlp.jp/proceedings/annual_meeting/2015/pdf_dir/C4-3.pdf
@jaganadhg
jaganadhg / gap statistics.py
Last active Feb 11, 2018
Implementation of Gap Statistic from Tibshirani, Walther, Hastie to determine the inherent number of clusters in a dataset with k-means clustering.
View gap statistics.py
#!/usr/bin/env python
"""
Author : Jaganadh Gopinadhan
Licence : Apahce 2
e-mail jaganadhg at gmail dot com
"""
import scipy
from sklearn.cluster import KMeans
View friggericvjagan.tex
%!TEX TS-program = xelatex
\documentclass[margin=0.1in]{friggeri-cv}
\usepackage{afterpage}
\usepackage{hyperref}
\usepackage{color}
\usepackage{xcolor}
\usepackage{smartdiagram}
\usepackage{fontspec}
\usepackage{float}
\usepackage{needspace}
@jaganadhg
jaganadhg / MSSS_BMS.txt
Last active Jul 1, 2016
MSSS_BMS.txthttps://avisingh599.github.io/deeplearning/visual-qa/
View MSSS_BMS.txt
Amazon question/answer data http://jmcauley.ucsd.edu/data/amazon/qa/
Deep Learning for Visual Question Answering https://avisingh599.github.io/deeplearning/visual-qa/
http://cs.umd.edu/~miyyer/data/deepqa.pdf
R Clustering Packages http://www.rdocumentation.org/taskviews/Cluster
Deep learning http://deeplearning.net/software/pylearn2/tutorial/notebook_tutorials.html#notebook-tutorials
Cluster with Theano https://gist.github.com/erogol/7946246
View kmeanscosine.py
from sklearn.cluster import k_means_
from sklearn.metrics.pairwise import cosine_similarity, pairwise_distances
from sklearn.preprocessing import StandardScaler
def create_cluster(sparse_data, nclust = 10):
# Manually override euclidean
def euc_dist(X, Y = None, Y_norm_squared = None, squared = False):
#return pairwise_distances(X, Y, metric = 'cosine', n_jobs = 10)
You can’t perform that action at this time.