You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hivemall.apache.org by GitBox <gi...@apache.org> on 2019/01/18 00:46:26 UTC

[GitHub] takuti opened a new pull request #178: [HIVEMALL-233] RandomForest regressor accepts sparse vector input

takuti opened a new pull request #178: [HIVEMALL-233] RandomForest regressor accepts sparse vector input
URL: https://github.com/apache/incubator-hivemall/pull/178
 
 
   ## What changes were proposed in this pull request?
   
   Enable RandomForestRegressor to accept sparse vector input as RandomForestClassifier already does.
   
   #51 made incomplete modifications on RandomForestRegressor, while its classifier counterpart has been properly updated.
   
   ## What type of PR is it?
   
   Improvement
   
   ## What is the Jira issue?
   
   https://issues.apache.org/jira/browse/HIVEMALL-233
   
   ## How was this patch tested?
   
   Unit tests and manual test with tiny sample data:
   
   ```sql
   with customers as (
     select 1 as id, "male" as gender, 23 as age, "Japan" as country, 12 as num_purchases
     union all
     select 2 as id, "female" as gender, 43 as age, "US" as country, 4 as num_purchases
     union all
     select 3 as id, "other" as gender, 19 as age, "UK" as country, 2 as num_purchases
     union all
     select 4 as id, "male" as gender, 31 as age, "US" as country, 20 as num_purchases
     union all
     select 5 as id, "female" as gender, 37 as age, "Australia" as country, 9 as num_purchases
   ),
   training as (
     select
       array_concat(
         quantitative_features(
           array("age"),
           age
         ),
         categorical_features(
           array("country", "gender"),
           country, gender
         )
       ) as features,
       num_purchases
     from
       customers
   )
   select
     train_randomforest_regressor(
       feature_hashing(features), -- feature vector
       num_purchases, -- target value
       '-trees 40 -seed 31' -- hyper-parameters
     )
   from
     training
   ;
   ```
   
   ## Checklist
   
   - [x] Did you apply source code formatter, i.e., `./bin/format_code.sh`, for your commit?
   - [x] Did you run system tests on Hive (or Spark)?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services