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

ASF GitHub Bot commented on HIVEMALL-233:
-----------------------------------------

takuti commented on pull request #178: [HIVEMALL-233] RandomForest regressor 
accepts sparse vector input
URL: https://github.com/apache/incubator-hivemall/pull/178#discussion_r249576477
 
 

 ##########
 File path: 
core/src/main/java/hivemall/utils/collections/lists/DoubleArrayList.java
 ##########
 @@ -70,7 +70,7 @@ public DoubleArrayList add(@Nonnull double[] values) {
     private void expand(int max) {
         while (data.length < max) {
             final int len = data.length;
-            double[] newArray = new double[len * 2];
+            double[] newArray = new double[(len + 1) * 2];
 
 Review comment:
   See d7695d461056b21eab25465e015c582edc2b57ce
   
   In case # of samples is less than 10, [`SmileExtUtils#sort` calls 
`DoubleArrayList(0)`](https://github.com/apache/incubator-hivemall/blob/7b61a3be8178fef40154f4009fef2989a9fd4c49/core/src/main/java/hivemall/smile/utils/SmileExtUtils.java#L190-L192),
 and zero-sized array list falls into infinite loop in the `expand` method as 
`newArray = new double[0 * 2]`. The change prevents this.
 
----------------------------------------------------------------
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:
[email protected]


> RandomForest regressor accepts sparse vector input
> --------------------------------------------------
>
>                 Key: HIVEMALL-233
>                 URL: https://issues.apache.org/jira/browse/HIVEMALL-233
>             Project: Hivemall
>          Issue Type: Improvement
>            Reporter: Takuya Kitazawa
>            Assignee: Takuya Kitazawa
>            Priority: Major
>
> While HIVEMALL-75 has enabled RandomForestClassifier to accept sparse vector 
> as an input, some crucial code in the classifier is not properly implemented 
> in its regressor counterpart; input feature vector is processed differently 
> by regressor and classifier.
> This ticket follows up to HIVEMALL-75 so that the regressor behaves similarly 
> to the classifier.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to