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
# MapReduce: gasto total realizado por las mujeres que han realizdo EXACTAMENTE | |
# 3 compras. | |
@get('/spending_female_3_orders_mr') | |
def spending_female_3_orders_mr(): | |
mapper = Code(""" | |
function countryMap() | |
{ | |
if (this.gender == "Female") { |
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
// Binomial coefficient | |
// Credits: github.com/jgferreiro | |
examples(); | |
function examples() { | |
var a, b; // numerator and denominator of our coeffiecient | |
a = 2; b = 1; | |
console.log('Binomial for a = ' + a + " and b = "+ b + ' is ' + binomialCoefficient(a, b)); |
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 k_total = 10; // number of times the event is repeated | |
var landa = 8; // Promedian number of error expected in a given time (Landa symbol) | |
var exponential = 2.718281828; | |
var total = 0; | |
var numerator, denominator; | |
// Sumatorio de k terminos usando la formula de poisson | |
function poisson(k, landa) { |
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 words = (function(){ | |
var sWords = document.body.innerText.toLowerCase().trim().replace(/[.,;?¿@]/g,' ').split(/[\s\/]+/g).sort(); | |
var iWordsCount = sWords.length; // count w/ duplicates | |
// array of words to ignore | |
var ignore = ['and','the','to','a','of','for','as','i','with','it','is','on','that','this','can','in','be','has','if', | |
'de', 'del', 'y', 'en', 'que', 'para', 'tu', 'con', 'su', 'mas', 'o', | |
'el','te', 'ti', 'un', 'lo', 'los', 'la', 'las', 'una', 'más', 'sus', 'este', 'desde', 'tras', | |
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
// Calculate the mean of a set. | |
var i; | |
var result = 0; | |
var data = [1, 2, 3, 4, 5, 6, 7, 8, 9]; // age. | |
var absFrec = [9, 8, 7, 6, 5, 4, 3, 2, 1]; // absolute frecuency. | |
var N = 0; // Total value of the set. | |
for (i = 0; i < data.length; i++) { | |
N += absFrec[i]; |
NewerOlder