Created by Christopher Manning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# <nbformat>2</nbformat> | |
# <markdowncell> | |
# Kernel Density Estimation with SciPy | |
# ==================================== | |
# <codecell> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
Logistic Regression | |
References : | |
- Jason Rennie: Logistic Regression, | |
http://qwone.com/~jason/writing/lr.pdf | |
Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# Test that I passed on codility.com for TopTal company | |
# | |
# Task #1 | |
def binary_gap(N): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn import linear_model | |
from scipy import stats | |
import numpy as np | |
class LinearRegression(linear_model.LinearRegression): | |
""" | |
LinearRegression class after sklearn's, but calculate t-statistics | |
and p-values for model coefficients (betas). | |
Additional attributes available after .fit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
import numpy as np | |
import scipy.stats as st | |
TtestResults = namedtuple("Ttest", "T p") | |
def t_welch(x, y, tails=2): | |
""" | |
Welch's t-test for two unequal-size samples, not assuming equal variances |
Here at PyData NYC, I heard a tutorial of how to use numpy and iPython notebooks. In a previous gist, I wrote drew all the zip codes of the Bronx in d3.js
This would be great for reproducing inforgraphics like Educational Attainment in New York City -- Brooklyn which looks a bit like a jigsaw puzzle:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(MASS) | |
require(ggplot2) | |
require(scales) | |
require(gridExtra) | |
pca <- prcomp(iris[,-5], | |
center = TRUE, | |
scale. = TRUE) | |
prop.pca = pca$sdev^2/sum(pca$sdev^2) |
OlderNewer