Skip to content

Instantly share code, notes, and snippets.

View jaidevd's full-sized avatar

Jaidev Deshpande jaidevd

View GitHub Profile
from traits.api import HasTraits, Property, Dict, cached_property, Any, Str, Int
class MyTraits(HasTraits):
a = Any
b = Property(Dict(key_trait=Str, value_trait=Int), depends_on=['a'])
@cached_property
@jaidevd
jaidevd / cossim.py
Created June 5, 2015 11:40
Make sklearn.metrics.pairwise.cosine_similarity optionally return sparse output.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
from sklearn.metrics.pairwise import check_pairwise_arrays
from sklearn.preprocessing import normalize
@jaidevd
jaidevd / scipy_window_gallery.ipynb
Last active June 15, 2017 16:40
A gallery of window functions in SciPy
@jaidevd
jaidevd / tree_widget_example.py
Last active August 29, 2015 14:20
Basic PySide layout example with TabWidget and TreeWidget
from PySide import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import datetime
IRIS_PATH = "/tmp/access"
@jaidevd
jaidevd / pyds.py
Last active August 29, 2015 14:19
View Python docstrings through $EDITOR
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
"""
@jaidevd
jaidevd / setup.md
Last active August 29, 2015 14:10
SciPy India 2014 Installation and Setup

SciPy India 2014 will feature a lot of hands-on, practical tutorial sessions that require the participants to have some software on their respective computers. Please follow the instructions here before you come to the conference, so that we may start the tutorials without any delay.

Installing Canopy

Canopy is the primary Python distribution that we will be using during the conference. You may use Anaconda, or the system Python distribution, or any other Python interpreter for the conference. However, please note that we may not be able to support any other distribution other than Canopy. This is because the Python packages we will be providing for the tutorials are customized for Canopy.

Please visit this link https://store.enthought.com/downloads/ and click on the "Download Canopy Express" button to download the Canopy installer. Run this installer to install Canopy.

import pandas as pd
import numpy as np
#attendance_data = pd.read_csv('AttendanceData.csv',index_col=2,
# parse_dates=True)
#attendance_data.columns = ['event_id', 'user_id']
event_data = pd.read_csv('EventData.csv',#skipfooter=1,
index_col=0)
event_data.columns = ['latitude', 'longitude']
@jaidevd
jaidevd / 0_reuse_code.js
Created June 2, 2014 12:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jaidevd
jaidevd / data_inspector.py
Last active January 2, 2016 17:09
A UI app for exploring training data for Kaggle's Galaxy Zoo competition.
################################################################################
# Description:
# -------------
# This is a TraistUI (http://docs.enthought.com/traitsui) application that
# is used for performing some exploratory data analysis on the training data
# from Kaggle's Galaxy Zoo competition.
# (http://kaggle.com/c/galaxy-zoo-the-galaxy-challenge)
# Broadly, it can be thought of as a browser for the data, which shows the
# training images, the target distribution functions and some metrics related
# to the training data.
\documentclass{beamer}
%
% Choose how your presentation looks.
%
% For more themes, color themes and font themes, see:
% http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
%
\mode<presentation>
{
\usetheme{Warsaw} % or try Darmstadt, Madrid, Warsaw, ...