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
import Algorithmia | |
import numpy as np | |
import json | |
# Only works inside Algorithmia, but easily modified | |
sc_pred = Algorithmia.client().algo('microprediction/sc_predict') | |
NUM_PREDICTIONS = Algorithmia.client().algo('micropredictoin/sc_num').pipe("").result | |
write_key = json.loads("data://.my/threeza_private/write_key.json").getString())['key'] | |
scenarios = sorted(list(np.random.randn(NUM_PREDICTIONS)) | |
predictions = {"name":"cop.json","write_key":write_key,"values":scenarios} |
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
import requests | |
ANIMALS = requests.get('https://gist.githubusercontent.com/atduskgreg/3cf8ef48cb0d29cf151bedad81553a54/raw/82f142562cf50b0f6fb8010f890b2f934093553e/animals.txt').text.split('\n') | |
def animals_of_len(k): | |
return [ a.lower() for a in ANIMALS if len(a)==k ] |
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 microprediction import MicroWriter | |
import time | |
from pprint import pprint | |
import numpy as np | |
# Enters all the z1 streams | |
# This might be run once a day, say. | |
from microprediction import new_key | |
WRITE_KEY = new_key(difficulty=10) |
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 getjson import getjson | |
from pprint import pprint | |
# Human : "I don't see who is winning what." | |
# Crawler: "Hold my beer ..." | |
def descend(d): | |
return {k: v for k, v in sorted(d.items(), key=lambda item: item[1], reverse=True)} | |
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
CACHE = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))+'/cache/' | |
def picklecached(): | |
""" | |
A function that creates a decorator which will use "cachefile" for caching the results of the decorated function "fn". | |
Also stores a CSV so we can quickly inspect the result ... though only pickles are used in loading. | |
""" | |
def decorator(fn): # define a decorator for a function "fn" |
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
using Microprediction | |
using Distributions | |
write_config = Microprediction.Config("66a78936 YOUR KEY HERE 6482eb36249a") | |
test_stream_name = "emojitracker-twitter-grinning_face_with_smiling_eyes.json" | |
function make_sample() | |
values = Microprediction.get_lagged_values(write_config, test_stream_name) | |
good_values = values[1:50] | |
distribution = fit(Poisson, convert(Array{Int64}, good_values)) |
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
Job Category: IT | |
Location: United States, WA, Redmond | |
Job ID: 786045 | |
Product: (Not Product Specific) | |
Division: IT | |
The Data & Decision sciences Team within technology Office in MSIT, helps drive actionable business intelligence through advanced statistical modeling and business analytics, throughout Microsoft. The team focuses on enterprise level engagement, where advanced data mining and modeling skills are needed to find business insights. We have a strong team of experienced statistician with an average experience of 15+ years in various industries. Currently we are expanding our work in areas of simulation, system modeling and text mining, to support our internal clients. Our goal is to support business performance enabled through data analysis, statistical modeling - resulting into business impact. Candidate will be expected to work with internal clients on analytic projects and identify potential improvement opportunities. The candidate must possess a passion for advanced analytics and skills in areas of |
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
def at_least_2d_column(x): | |
return at_least_2d_row(x).T | |
def at_least_2d_row(x): | |
return np.atleast_2d(np.ravel(x)) |
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
import time | |
def intrinio_last_price(ticker, api_key=INTRINIO_KEY): | |
from getjson import getjson | |
template_url = 'https://api-v2.intrinio.com/securities/TICKER/prices/realtime?api_key=API_KEY' | |
url = template_url.replace('TICKER',ticker.upper()).replace('API_KEY',api_key) | |
try: | |
return getjson(url)['last_price'] | |
except: | |
time.sleep(0.2) |