Skip to content

Instantly share code, notes, and snippets.

View iamprakashom's full-sized avatar
🍺
Building Neobank for SMEs & Startups.

Om Prakash iamprakashom

🍺
Building Neobank for SMEs & Startups.
View GitHub Profile
@iamprakashom
iamprakashom / unsupervised_alt.py
Created January 7, 2017 05:06 — forked from AlexandreAbraham/unsupervised_alt.py
These are two implementations of the silhouette score. They are compatible with the scikit learn implementation but offers different drawbacks in term of complexity and memory usage. The slow version needs no memory but is painfully slow and should, I think, not be used. The second one is based on a block strategy: distance between samples and c…
""" Unsupervised evaluation metrics. """
# License: BSD Style.
from itertools import combinations
import numpy as np
from sklearn.utils import check_random_state
from sklearn.metrics.pairwise import distance_metrics
from sklearn.metrics.pairwise import pairwise_distances
@iamprakashom
iamprakashom / artivatic-ml-assignment.ipynb
Created January 8, 2017 14:27
Clustering Assignment
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iamprakashom
iamprakashom / md5.coffee
Created April 17, 2017 10:08 — forked from amscotti/md5.coffee
MD5 hashing
crypto = require('crypto');
#Quick MD5 of text
text = "MD5 this text!"
md5hash1 = crypto.createHash('md5').update(text).digest("hex")
#MD5 of text with updates
m = crypto.createHash('md5')
m.update("MD5 ")
m.update("this ")
@iamprakashom
iamprakashom / Makefile.install_opencv_fedora
Last active June 29, 2017 04:32 — forked from wuerges/Makefile.install_opencv_fedora
Makefile for Installing OpenCV in Fedora 23 with Python 3 support.
install_opencv:
sudo dnf install --best --allowerasing \
cmake python-devel numpy gcc gcc-c++ \
python3-devel python3-numpy \
gtk2-devel libdc1394-devel libv4l-devel ffmpeg-devel \
gstreamer-plugins-base-devel libpng-devel libjpeg-turbo-devel \
jasper-devel openexr-devel libtiff-devel libwebp-devel \
tbb-devel eigen3-devel python-sphinx texlive git
if [ ! -d opencv/ ]; then \
@iamprakashom
iamprakashom / main.cpp
Created June 29, 2017 13:14 — forked from nikotan/main.cpp
face detection sample code for OpenCV
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <opencv/ml.h>
void doMosaic(IplImage* in, int x, int y,
int width, int height, int size);
int main (int argc, char **argv)
{
int i, c;
@iamprakashom
iamprakashom / Installing-xgboost.md
Created July 16, 2017 04:54 — forked from DanielBeckstein/Installing-xgboost.md
How to install xgboost for Python on Linux

Commands Linux-Terminal

How to use inside python scripts

@iamprakashom
iamprakashom / pca_animation.m
Created August 18, 2017 18:36 — forked from anonymous/pca_animation.m
Matlab code to produce PCA animations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Matlab code to produce PCA animations shown here:
% http://stats.stackexchange.com/questions/2691
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Static image
clear all
rng(42)
@iamprakashom
iamprakashom / eblow.py
Created August 30, 2017 10:08 — forked from calippo/eblow.py
[scikit-learn/sklearn, pandas] Plot percent of variance explained for KMeans (Elbow Method)
import pandas as pd
import matplotlib.pyplot as plt
import seaborn
from sklearn.cluster import KMeans
import numpy as np
from scipy.spatial.distance import cdist, pdist
def eblow(df, n):
kMeansVar = [KMeans(n_clusters=k).fit(df.values) for k in range(1, n)]
centroids = [X.cluster_centers_ for X in kMeansVar]
@iamprakashom
iamprakashom / install_anaconda.py
Created September 11, 2017 00:00 — forked from curioswati-zz/install_anaconda.py
Installer script for Anaconda in ubuntu 14.04
#!/usr/bin/env python
import subprocess
import optparse
import platform
#---------------------------------------Globals----------------------------------------------------
install = []
PLATFORM = platform.system()
ARCHITECTURE = platform.architecture()[0]