Skip to content

Instantly share code, notes, and snippets.

View btabibian's full-sized avatar

Behzad Tabibian btabibian

View GitHub Profile
@btabibian
btabibian / svm_tutorial.cpp
Created July 26, 2016 20:57
SVM using OpenCV
/*
This file is Implementation of OpenCV SVM tutorial program.
Implementation of OpenCV SVM tutorial is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Implementation of ARFL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
# You need arabic_reshaper <https://github.com/edx/edx-certificates/blob/master/arabic_reshaper.py>
@btabibian
btabibian / gist:5287795
Last active December 15, 2015 16:18
convert a Pandas Series of categorical data into integer type Series.
import numpy as np
import pandas as pd
def category_to_int(data,default=-1):
new_data=pd.Series(np.zeros(data.shape)-1,index=data.index,name=data.name+"_int")
uniques=data.unique()
for i in zip(uniques,xrange(uniques.shape[-1])):
new_data[data==i[0]]=i[1]
return new_data
@btabibian
btabibian / Preprocessing.py
Last active August 3, 2016 14:25
An implementation of a recommendation system using jaccard similarity and minhashing. For Setup and more info look at Setup below
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# Reading Data from text and store in MongoDB
# ==========================================
#
# + Set the name of database to _movies_.
# + ensure indecies are placed.