Ignore:
Timestamp:
01/15/12 00:05:13 (2 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
a1d3d929e242ed688f1d840f8d2fd47995e6da25
Message:

Conversion to numpy now supports multiple classes (Ticket #1012)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/orange/gslconversions.cpp

    r7665 r9532  
    4040 
    4141void parseMatrixContents(PExampleGenerator egen, const int &weightID, const char *contents, const int &multiTreatment, 
    42                          bool &hasClass, bool &classVector, bool &weightVector, bool &classIsDiscrete, int &columns, 
     42                         bool &hasClass, bool &classVector, bool &multiclassVector, bool &weightVector, bool &classIsDiscrete, int &columns, 
    4343                         vector<bool> &include) 
    4444{ 
     
    4646 
    4747  columns = 0; 
    48   int classIncluded = 0, attrsIncluded = 0, weightIncluded = 0; 
     48  int classIncluded = 0, attrsIncluded = 0, weightIncluded = 0, multiclassIncluded = 0; 
    4949  bool attrsRequested = false, classRequested = false, weightRequested = false; 
     50  bool multiclassRequested = false; 
    5051  const char *cp; 
    5152  for(cp = contents; *cp && (*cp!='/'); cp++) { 
     
    6162      case 'W': weightRequested = true; 
    6263      case 'w': weightIncluded++; 
     64                break; 
     65 
     66      case 'M': multiclassRequested = true; 
     67      case 'm': multiclassIncluded++; 
    6368                break; 
    6469 
     
    8893        case 'w': weightVector = (weightID != 0); break; 
    8994        case 'W': weightVector = true; break; 
     95 
     96        case 'm': multiclassVector = (egen->domain->classVars->size() != 0); break; 
     97        case 'M': multiclassVector = true; break; 
    9098        default: 
    9199          raiseErrorWho("parseMatrixContents", "unrecognized character '%c' in format string '%s')", *cp, contents); 
     
    116124    if (weightID) 
    117125      columns += weightIncluded; 
     126  } 
     127 
     128  if (multiclassIncluded || multiclassVector) { 
     129      columns += multiclassIncluded * egen->domain->classVars->size(); 
    118130  } 
    119131 
Note: See TracChangeset for help on using the changeset viewer.