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
var fake_dimension = { | |
filter: function(f) { //Create filtering function | |
if(f) { | |
queryFilter[fake_dimension] = f; //Set filter in query filter | |
refresh(); //Make the AJAX call. | |
} | |
} | |
} |
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
var crossfilter = require("crossfilter.js"); | |
//Load your data | |
var data = [{"a": 1, "b":2}, {"a":2, "b":3}]; | |
//Apply crossfilter | |
var ndx = crossfilter(data); | |
var dimension = ndx.dimension(function(d){return d.a}); | |
var group = dimension.group(); |
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
function handle_filter_request(req,res,next) { | |
filter = req.param("filter") ? JSON.parse(req.param("filter")) : {} | |
if(filter[dimension]){ | |
dimension.filter(filter[dimension]); | |
} | |
results[dimension]= {values:group.all(),top: group.top(1)[0].value}; | |
res.writeHead(200, { 'content-type': 'application/json' }); | |
res.end((JSON.stringify(results))); | |
} |
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
29 attributes(24 filtering) | |
1mil - memory exceeded | |
500k - memory exceeded | |
250k - memory exceeded | |
100k -1100 | |
50k- 1000 | |
20 attributes (15 filtering) | |
1mil - memory exceeded | |
500k - memory exceeded |
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
io.on("connection", function (socket){ | |
t.on("tweet", function(tweet){ | |
var tweetText = tweet.text; | |
var score = s.score(tweetText); | |
socket.emit("tweet", {tweet: tweetText, score:score}) | |
}); | |
}); |
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
tweets = []; | |
socket.on("tweet", function(data){ | |
console.log(data); | |
tweets.push(data); | |
}); |
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
function(text){ | |
var score = 0; | |
var words = text.split(" "); | |
for(var i in words){ | |
word = words[i]; | |
if(word in this.wordList){ | |
score+= this.wordList[word]; | |
} | |
} | |
return score/words.length; |
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
setEventHandlers = function( ) { | |
io.sockets.on("connection", onSocketConnection); | |
} | |
onSocketConnection = function(client){ | |
players++; | |
client.on("new player", onNewPlayer); | |
client.on("add word", onAddWord); | |
client.on("disconnect", onDisconnect); | |
}; |
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
function init(err, data){ | |
reset(); | |
io = require('socket.io').listen(app); | |
if(err){ | |
console.log("Error reading dictionary: "+err); | |
} | |
//Conver dictionary to a list | |
word_list = data.toString().split("\n"); | |
//Listen for events | |
setEventHandlers(); |
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 generateData(X, y): | |
i=0 | |
for i in range(0,N): | |
datapoint = [random.uniform(-1,1), random.uniform(-1,1)] | |
X[i] = datapoint | |
if(datapoint[0] + datapoint[1] > 0): | |
y[i] = 1 | |
else: | |
y[i] = -1 |
OlderNewer