Professional Documents
Culture Documents
Functions
By
Dr. R. Satya Krishna Sharma
Mean
Input:10
numbers (x1, x2, ..., x10)
Map Input:
◦ Input: List of 10 numbers
◦ Output: (key, value) pairs where key is a constant (e.g., 1) and
value is the corresponding number from the input list.
◦ Input: [4, 8, 12, 6, 5, 3, 9, 11, 15, 7]
◦ Map Output: [(1, 4), (1, 8), ..., (1,7)]
Sort: [(1, 3), (1, 4), (1, 5), ..., (1,15)]
Shuffle:[(1,(3,4,5,6,7,8,9,11,12,15)]
Reduce: [1,(3+4+5+……12,15)/(10)]
[1,(80/10)]
[1,8]
Standard Deviation
Let's consider the numbers: [4, 8, 12, 6, 5, 3, 9, 11, 15, 7]
1st Map Output: [(1, 4), (1, 8), ..., (1, 7)]
1st Sort : [(1, 3), (1, 4), (1, 5)), ..., (1, 15)]
1st Shuffle:[1,(3,4,5,6,…….15))
1st Reduce:[1,((3+4+5+6+…….+15),10)]
:[1,(80,10)]
The above is as good as importing map reduce of mean
2ndMap and sort Output[(1,(3-8)), (1,(4-8)),….. (1,(15-8))]
[(1,((3-8)^2), (1,((4-8) ^2)),….. (1,((15-8)^2))]
2ndShuffle:[(1 ,((3-8)^2), (1,((4-8) ^2)),….. (1,((15-8)^2))]
[(1,((3-8)^2), ((4-8) ^2)),….. ((15-8)^2))]
2nd Reduce: [1,(25+16+9---+49]
[1,SQRT(130/(10-1))]
Skewness
Let's consider the numbers: [4, 8, 12, 6, 5, 3, 9, 11, 15, 7]
Import Map Reduce of Standard Deviation
2ndMap and sort Output[(1,(3-8)), (1,(4-8)),….. (1,(15-8))]
[(1,((3-8)^3), (1,((4-8) ^3)),….. (1,((15-
8)^3))]
1.Map (Orders):
•Input: (key, value) pairs where the key is the customer_id and the value is the order
information.
•Emit key-value pairs as (customer_id, ("order", order_info)).
2.Map (Customers):
•Input: (key, value) pairs where the key is the customer_id and the value is the
customer information.
•Emit key-value pairs as (customer_id, ("customer", customer_info))