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 matplotlib | |
import matplotlib.pyplot as plt | |
# Iris petal length/width scatterplot (greatest class correlation) | |
# Dataset: http://archive.ics.uci.edu/ml/datasets/Iris | |
# Output: https://imgur.com/9TWhn | |
def data(): | |
lists = [line.strip().split(",") for line in open('flowerdata.txt', 'r').readlines()] | |
return [map(float, l[:4]) for l in lists], [l[-1] for l in lists] |
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 | |
import redis | |
import urllib | |
import threading | |
import simplejson | |
class Generator(threading.Thread): | |
def __init__(self, generator, output_channel, _redis=None): | |
threading.Thread.__init__(self) | |
self.generator = generator |
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 redis | |
import threading | |
class Listener(threading.Thread): | |
def __init__(self, r, channels): | |
threading.Thread.__init__(self) | |
self.redis = r | |
self.pubsub = self.redis.pubsub() | |
self.pubsub.subscribe(channels) | |
NewerOlder