bugGNU Octave - Bugs: bug #45518, randsample not implemented ...

 
 

bug #45518: randsample not implemented (implementation supplied)

Submitted by:  Lachlan Andrew <lachlan>
Submitted on:  Fri 10 Jul 2015 07:26:56 AM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Feature Request
Status: FixedAssigned to: None
Originator Name: LachlanOpen/Closed: Closed
Release: 4.0.0Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sat 11 Jul 2015 03:32:43 PM UTC, comment #4:

Thanks, I applied your patch to the repository function.

Nir Krakauer <nir_krakauer>
Sat 11 Jul 2015 02:36:01 AM UTC, comment #3:

Thanks, Nir. I didn't notice your implementation -- I checked for it in 3.8.2 instead of 4.0.0 / development.

The attached patch:
- fixes a bug that prevents sampling k from n<k with replacement
- implements weighted sampling without replacement, which is also missing from Matlab, but should really be there
- puts brackets around if/while conditions, which I was told is an Octave coding standard.

(file #34423)

Lachlan Andrew <lachlan>
Project Member
Fri 10 Jul 2015 04:07:40 PM UTC, comment #2:

Adding package maintainer to CC list.

Could you also add some test blocks to the function?

Carnë Draug <carandraug>
Project Member
Fri 10 Jul 2015 12:40:53 PM UTC, comment #1:

randsample is already available in the Octave Forge Statistics package: https://sourceforge.net/p/octave/statistics/ci/6672813641f9ce95884a20f29fa2c420f680d253/tree/inst/randsample.m

So it would be better to either use the existing function, or supply a patch for it if for some reason it doesn't meet your needs.

Nir Krakauer <nir_krakauer>
Fri 10 Jul 2015 07:26:56 AM UTC, original submission:

The attached file implements Matlab's randsample, which is used by the gmdistribution and fitgmdist files provided in bug reports #45516 and #45517.

Lachlan Andrew <lachlan>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #34423:  randsample.patch added by lachlan (4KiB - text/x-patch - randsample patch allowing k>n for sampling with replacement)
file #34410:  randsample.m added by lachlan (3KiB - text/x-objcsrc - randsample implementation)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Updated the item)
  • -unavailable- added by carandraug (Arno Onken - maintainer of statistics package)
  • -unavailable- added by nir_krakauer (Posted a comment)
  • -unavailable- added by lachlan (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 11 Jul 2015 03:54:24 PM UTCmtmillerStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sat 11 Jul 2015 02:36:01 AM UTClachlanAttached File-=>Added randsample.patch, #34423
    Fri 10 Jul 2015 04:07:40 PM UTCcarandraugCarbon-Copy-=>Added -unavailable-
    Fri 10 Jul 2015 07:26:56 AM UTClachlanAttached File-=>Added randsample.m, #34410

    Back to the top


    Powered by Savane 3.1-cleanup1