You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hivemall.apache.org by takuti <gi...@git.apache.org> on 2017/03/03 08:56:52 UTC
[GitHub] incubator-hivemall issue #58: [WIP][HIVEMALL-24] Scalable field-aware factor...
Github user takuti commented on the issue:
https://github.com/apache/incubator-hivemall/pull/58
### feature_pairs()
```sql
drop temporary function if exists feature_pairs;
create temporary function feature_pairs as 'hivemall.ftvec.pairing.FeaturePairsUDTF';
select
t1.rowid,
t2.i,
t2.j,
t2.Xi,
t2.Xj
from (
select 1 as rowid, array("1:3:1", "1:11:2", "2:14:3", "3:19:4") as features
) t1
LATERAL VIEW feature_pairs(features, "-ffm -feature_hashing 10 -num_fields 5") t2 as i, j, Xi, Xj;
```
Output:
```
t1.rowid t2.i t2.j t2.xi t2.xj
1 0 NULL NULL NULL
1 0 NULL 1.0 NULL
1 16 56 1.0 2.0
1 17 71 1.0 3.0
1 18 96 1.0 4.0
1 1 NULL 2.0 NULL
1 57 71 2.0 3.0
1 58 96 2.0 4.0
1 2 NULL 3.0 NULL
1 73 97 3.0 4.0
1 3 NULL 4.0 NULL
```
Todo:
- Support a case that `field` is not specified e.g., `11:2`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---