datafu-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam Steingold (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DATAFU-45) RFE: CartesianProduct
Date Wed, 30 Apr 2014 13:37:17 GMT

    [ https://issues.apache.org/jira/browse/DATAFU-45?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13985507#comment-13985507
] 

Sam Steingold commented on DATAFU-45:
-------------------------------------

later I will do {{BagConcat}} & {{BagGroup}}:

{code}
my_stage3 = foreach (group my_stage2 by id) {
  keywords = BagConcat(my_stage2.keywords);
  keywords = BagGroup(keywords.(keyword,weight),keywords.keyword);
  generate group as id, keywords as keywords;
};
describe my_stage3;
-- dump my_stage3;
{code}

So all I want to do now is replace 
{code}
(3,{(i),(j)},0.5)
(1,{(i),(k)},0.5)
{code}
with
{code}
(3,{(i,0.5),(j,0.5)})
(1,{(i,0.5),(k,0.5)})
{code}


> RFE: CartesianProduct
> ---------------------
>
>                 Key: DATAFU-45
>                 URL: https://issues.apache.org/jira/browse/DATAFU-45
>             Project: DataFu
>          Issue Type: New Feature
>            Reporter: Sam Steingold
>
> Given two bags, produce their [Cartesian product|http://en.wikipedia.org/wiki/Cartesian_product]:
> {code}
> B1: bag{T1}
> B2: bag{T2}
> CartesianProduct(B1,B2): bag{(T1,T2)}
> {code}
> Use case:
> {code}
> toks = TOKENIZE((charray)$0,',');
> kwds = CartesianProduct(toks, {1.0/(double)SIZE(toks)});
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message