Skip to content

Instantly share code, notes, and snippets.

View ipeirotis's full-sized avatar

Panos Ipeirotis ipeirotis

View GitHub Profile
@ipeirotis
ipeirotis / hourly-activity-percentages-odesk.R
Created June 21, 2012 19:42
Creating a smoothed activity plot
library(RPostgreSQL)
library(sqldf)
library(KernSmooth)
# Connect to the database
drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname='odw', host='localhost', user='panos', password='password', port='12345')
# Retrieve the data from the database.
# Query columns: active_contractors, total_contractors, percent_activity, local_dayoftheweek, local_hour, country
Data points: 500
Workers: 5
Low rho: 0.1
High rho: 0.9
----
Round: 1... 2... 3... 4... 5... 6... 7... 8... 9... 10... 11... 12... 13... 14... 15... 16... Done!
----
True mu = 0.0
Estimated mu = -2.4669698323703853
True sigma = 1.0
Data points: 1000
Workers: 50
Low rho: 0.0
High rho: 0.5
----
Round: 1...
Average absolute estimation error for z-values: 0.7216256823227171
Average relative estimation error for z-values: 1.202467298579486
Average absolute estimation error for correlation values: 0.003948409074838416
Average relative estimation error for correlation values: 0.035579687445173605
@ipeirotis
ipeirotis / WikiSynonyms-BarackObama.json
Created February 25, 2013 22:15
Synonyms for the term "Obama" from the WikiSynonyms service.
{
"http": 200,
"message": "success",
"terms": [
{
"term": "Barack Obama",
"canonical": 1,
"oskill": 0
},
{
@ipeirotis
ipeirotis / WikiSynonyms-HillaryClinton.json
Last active December 14, 2015 05:18
Synonyms for the term "Hillary Clinton" from the WikiSynonyms service.
{
"http": 200,
"message": "success",
"terms": [
{
"term": "Hillary Rodham Clinton",
"canonical": 1,
"oskill": 0
},
{
@ipeirotis
ipeirotis / WikiSynonyms-C++.json
Created February 25, 2013 22:27
Synonyms for the term C++
{
"http": 200,
"message": "success",
"terms": [
{
"term": "C++",
"canonical": 1,
"oskill": 1
},
{
@ipeirotis
ipeirotis / WikiSynonyms-Python.json
Created February 26, 2013 03:19
Response of the WikiSynonyms service for the term 'Python'. Since this is a disambiguation page, the service returns the different 'senses' of the word and you need to pick the one that you want.
{
"http": 300,
"message": "The entry is a disambiguation page in Wikipedia. Please query again with one of the returned terms",
"terms": [
"Armstrong Siddeley Python",
"CMU Common Lisp",
"CPython",
"Colt Python",
"Computer",
"Monty Python",
@ipeirotis
ipeirotis / WikiSynonyms-PythonProgrammingLanguage.json
Created February 26, 2013 03:23
Response of the WikiSynonyms service for the term 'Python (programming language)'. [http://wikisynonyms.ipeirotis.com/api/Python%20(programming%20language)]
{
"http": 200,
"message": "success",
"terms": [
{
"term": "Python (programming language)",
"canonical": 1,
"oskill": 1
},
{
### Cohort Analysis
import matplotlib.pyplot as plt
# Connect to the BigQuery API
from googleapiclient.discovery import build
from oauth2client import client
credentials = client._get_application_default_credential_from_file('client_secrets.json')
credentials = credentials.create_scoped('https://www.googleapis.com/auth/bigquery')
@ipeirotis
ipeirotis / MTurk_Cohort_Analysis.tsv
Created February 29, 2016 15:30
Data for Mechanical Turk Cohort Analysis
firstSeen lastSeen cnt
2014-05 2014-05 882
2014-05 2014-06 255
2014-05 2014-07 108
2014-05 2014-08 93
2014-05 2014-09 68
2014-05 2014-10 44
2014-05 2014-11 59
2014-05 2014-12 35
2014-05 2015-01 33