Skip to content

Instantly share code, notes, and snippets.

@jaidevd
jaidevd / ann.py
Created March 24, 2012 22:55
Basic Perceptron Learning for AND Gate
import numpy as np
class Perceptron:
def __init__(self,Weights,Biases):
self.Weights = Weights
self.Biases = Biases
def Train(self, Training, LearningRate):
@jaidevd
jaidevd / svc_imseg.py
Created April 3, 2012 00:43
Image Segmentation by Clustering
#!/usr/bin/env python -tt
import numpy as np
import scipy as sp
import pylab as pl
from sklearn.feature_extraction.image import grid_to_graph
from sklearn.cluster import KMeans
from scikits.image.data import imread
# Read image
@jaidevd
jaidevd / traitschaco.py
Created April 30, 2012 11:16
Traits tutorial by Gael Varoquaux modified to use a Chaco instead of matplotlib
#!/usr/bin/env python
from threading import Thread
from time import sleep
from traits.api import HasTraits, Instance, String, Float, Enum, Button
from traitsui.api import View, Item, Group, HSplit, Handler
from traitsui.menu import NoButtons
from scipy import rand, indices, exp, sqrt, sum
from chaco.api import ArrayPlotData, Plot
from enable.component_editor import ComponentEditor
@jaidevd
jaidevd / fftdivide.py
Created August 16, 2012 17:08
Harshad's problem
# You need to have matplotlib installed to be able to plot anything in Python.
# Suppose your data is a variable 'data'
from matplotlib.pyplot import plot, show
try:
from numpy.fft import fft
except:
from numpy import fft
x = data[:,1] # 2nd column
@jaidevd
jaidevd / pyconindia2012.json
Created October 1, 2012 03:08 — forked from sanand0/pyconindia2012.json
All 566 tweets mentioning #pyconindia #pyconindia2012 and @pyconindia until 4:10pm IST on 30-Sep-2012
{"iso_language_code": "da", "to_user_name": "Jishnu", "to_user_id_str": "110358179", "profile_image_url_https": "https://si0.twimg.com/profile_images/1761677446/2850384465_604be38694_b__copy__normal.jpg", "from_user_id_str": "15649930", "text": "@jishnu7 Automated Data Analysis talk By S Anand is at A1 #PyconIndia2012", "from_user_name": "Ramakrishna Reddy", "in_reply_to_status_id_str": "252282073249902593", "profile_image_url": "http://a0.twimg.com/profile_images/1761677446/2850384465_604be38694_b__copy__normal.jpg", "id": 252284135371067392, "to_user": "jishnu7", "source": "<a href="http://twitter.com/">web</a>", "in_reply_to_status_id": 252282073249902593, "id_str": "252284135371067392", "from_user": "ramkrsna", "from_user_id": 15649930, "to_user_id": 110358179, "geo": null, "created_at": "Sun, 30 Sep 2012 05:49:59 +0000", "metadata": {"result_type": "recent"}}
{"iso_language_code": "da", "to_user_name": null, "to_user_id_str": "0", "profile_image_url_https": "https://si0.twimg.com/pr
@jaidevd
jaidevd / pycon.py
Created October 2, 2012 03:47
Basic extraction, analysis and visualization of PyconIndia 2012 tweets
#!/usr/bin/env python
import os
import json
import numpy as np
from pandas import DataFrame, concat
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import PCA
from sklearn.cluster import KMeans
from matplotlib.pyplot import imshow, plot, show, figure, title, yticks
@jaidevd
jaidevd / scipy_requirements.md
Last active December 31, 2015 00:49
Requirements for tutorials at SciPy India 2013

Python modules required for tutorials at SciPy India 2013

Dear participants,

Here is a checklist of the packages that you will require in order to make the most out of the tutorials being offered at SciPy India 2013. For the list of tutorials offered, please visit http://scipy.in/2013/schedule/

  1. NumPy
  2. SciPy
  3. Matplotlib
\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, ...
@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.
@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