Changeset 11815:38b3572a95d2 in orange


Ignore:
Timestamp:
12/17/13 11:25:19 (4 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixed TMakeRandomIndicesMultiple.

Location:
source/orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source/orange/trindex.cpp

    r11703 r11815  
    440440     return operator()(gen->numberOfExamples(), ap0); 
    441441 
     442  if (!gen->domain->classVar) 
     443     if (stratified==TMakeRandomIndices::STRATIFIED_IF_POSSIBLE) 
     444       return operator()(gen->numberOfExamples(), ap0); 
     445     else 
     446       raiseError("invalid example generator or class-less domain"); 
     447 
     448   if (gen->domain->classVar->varType!=TValue::INTVAR) 
     449     if (stratified==TMakeRandomIndices::STRATIFIED_IF_POSSIBLE) 
     450       return operator()(gen->numberOfExamples(), ap0); 
     451     else 
     452       raiseError("cannot prepare stratified indices (non-discrete class values)"); 
     453 
    442454  if (!randomGenerator && (randseed<0)) 
    443455    raiseCompatibilityWarning("object always returns the same indices unless either 'randomGenerator' or 'randseed' is set"); 
     
    458470      byclasses[(*ei).getClass().intV].push_back(nexamples++); 
    459471 
    460   int no= (p0<=1.0) ? int(p0*nexamples+0.5) : int(p0+0.5); 
     472  int no= (ap0 <= 1.0) ? int(ap0 * nexamples + 0.5) : int(ap0 + 0.5); 
    461473  rsrgen rg(randomGenerator, randseed); 
    462474 
  • source/orange/trindex.hpp

    r11703 r11815  
    9696  __REGISTER_CLASS 
    9797 
    98   float p0; // proportion/number of examples 
     98  float p0; //P proportion/number of examples 
    9999 
    100100  TMakeRandomIndicesMultiple(const float &p0=1.0, const int &stratified=TMakeRandomIndices::STRATIFIED_IF_POSSIBLE, const int &randseed=-1); 
Note: See TracChangeset for help on using the changeset viewer.