Changeset 239:53be0d6610b1 in orange


Ignore:
Timestamp:
09/04/03 22:21:25 (10 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
4f3dace9ea69b9e159ec40084111ebe4fc20a4cf
Message:

no message

Location:
source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • source/Orange.dsp

    r191 r239  
    5858# Begin Special Build Tool 
    5959SOURCE="$(InputPath)" 
    60 PostBuild_Cmds=del "c:\program files\python22\lib\site-packages\orange\orange.pyd"  "c:\program files\upx" "c:\temp\orange\release\orange.pyd" -o "d:\ai\orange\modules\orange.pyd" rem copy "c:\temp\orange\release\orange.pyd" "c:\program files\python22\lib\site-packages\orange\orange.pyd" 
     60PostBuild_Desc=UPXing Orange 
     61PostBuild_Cmds=del "d:\ai\orange\modules\orange.pyd"    "c:\program files\upx" "c:\temp\orange\release\orange.pyd" -o "d:\ai\orange\modules\orange.pyd" rem copy "c:\temp\orange\release\orange.pyd" "d:\ai\orange\modules\orange.pyd" 
    6162# End Special Build Tool 
    6263 
     
    740741# Begin Source File 
    741742 
    742 SOURCE=.\orange\linreg.cpp 
    743 # End Source File 
    744 # Begin Source File 
    745  
    746743SOURCE=.\orange\lookup.cpp 
    747744 
  • source/include.dsp

    r166 r239  
    100100# Begin Source File 
    101101 
    102 SOURCE=.\include\Nrutil.cpp 
    103 # End Source File 
    104 # Begin Source File 
    105  
    106102SOURCE=.\include\primes.c 
    107103# End Source File 
    108104# Begin Source File 
    109105 
    110 SOURCE=.\include\pythag.cpp 
    111 # End Source File 
    112 # Begin Source File 
    113  
    114106SOURCE=.\include\statexceptions.cpp 
    115 # End Source File 
    116 # Begin Source File 
    117  
    118 SOURCE=.\include\svbksb.cpp 
    119 # End Source File 
    120 # Begin Source File 
    121  
    122 SOURCE=.\include\svdcmp.cpp 
    123107# End Source File 
    124108# End Group 
  • source/orange/cls_example.cpp

    r234 r239  
    295295    int index = (int)PyInt_AsLong(pyindex); 
    296296 
    297     if (!index) 
     297    if (index>0) 
    298298      PYERROR(PyExc_IndexError, "Example.setweight: invalid weight id", PYNULL);       
    299299 
  • source/orange/distvars.cpp

    r234 r239  
    201201NOT_IMPLEMENTED("percentile(float)") 
    202202 
    203 float TDistribution::density(const float &) const 
    204 NOT_IMPLEMENTED("density(float)") 
     203float TDistribution::p(const float &) const 
     204NOT_IMPLEMENTED("p(float)") 
    205205 
    206206 
     
    321321  } 
    322322  CHECKVALTYPE(val.varType); 
    323   return (val.varType==TValue::INTVAR) ? p(int(val)) : density(float(val)); 
     323  return (val.varType==TValue::INTVAR) ? p(int(val)) : p(float(val)); 
    324324} 
    325325 
     
    11121112} 
    11131113 
    1114 float TContDistribution::density(const float &x) const 
     1114float TContDistribution::p(const float &x) const 
    11151115{ const_iterator rb = upper_bound(x); 
    11161116  if (rb==end()) 
     
    11831183 
    11841184 
    1185 float TGaussianDistribution::density(const float &x) const 
     1185float TGaussianDistribution::p(const float &x) const 
    11861186{ return abs * exp(-sqr((x-mean)/2/sigma)) / (sigma*sqrt(2*pi)); } 
    11871187 
  • source/orange/distvars.hpp

    r234 r239  
    110110  virtual float percentile(const float &) const; 
    111111  virtual float error() const; 
    112   virtual float density(const float &) const; 
     112  virtual float p(const float &) const; 
    113113 
    114114  /* The below methods may be redefined (they are not implemented in TDistribution) */ 
     
    226226  virtual void  addfloat(const float &f, const float &w = 1.0); 
    227227  virtual void  setfloat(const float &v, const float &w); 
    228   virtual float density(const float &) const; 
     228  virtual float p(const float &) const; 
    229229 
    230230  virtual float average() const; 
     
    263263  virtual float randomFloat() const; 
    264264 
    265   virtual float density(const float &) const; 
     265  virtual float p(const float &) const; 
    266266  virtual bool  noDeviation() const; 
    267267}; 
  • source/orange/lib_kernel.cpp

    r234 r239  
    26862686      return PYNULL; 
    26872687     
    2688     return PyFloat_FromDouble(cont->density(x)); 
     2688    return PyFloat_FromDouble(cont->p(x)); 
     2689  PyCATCH 
     2690} 
     2691 
     2692 
     2693// Note that this is actually density, not p! 
     2694PyObject *ContDistribution_p(PyObject *self, PyObject *args) PYARGS(METH_VARARGS, "(x) -> float") 
     2695{ PyTRY 
     2696    TContDistribution *cont = getContDistribution(self); 
     2697    float x; 
     2698    if (!cont || !PyArg_ParseTuple(args, "f:ContDistribution.p", &x)) 
     2699      return PYNULL; 
     2700     
     2701    return PyFloat_FromDouble(cont->p(x)); 
    26892702  PyCATCH 
    26902703} 
     
    27442757      return PYNULL; 
    27452758     
    2746     return PyFloat_FromDouble(SELF_AS(TGaussianDistribution).density(x)); 
     2759    return PyFloat_FromDouble(SELF_AS(TGaussianDistribution).p(x)); 
     2760  PyCATCH 
     2761} 
     2762 
     2763// This is actually density, not p! 
     2764PyObject *GaussianDistribution_p(PyObject *self, PyObject *args) PYARGS(METH_VARARGS, "(x) -> float") 
     2765{ PyTRY 
     2766    float x; 
     2767    if (!PyArg_ParseTuple(args, "f:GaussianDistribution.p", &x)) 
     2768      return PYNULL; 
     2769     
     2770    return PyFloat_FromDouble(SELF_AS(TGaussianDistribution).p(x)); 
    27472771  PyCATCH 
    27482772} 
  • source/orange/preprocessors.cpp

    r234 r239  
    311311  if (deviations) 
    312312    PITERATE(TVariableFloatMap, vi, deviations) { 
    313       const int pos = domain.getVarNum((*vi).first); 
     313      PVariable var = (*vi).first; 
     314      if (var->varType != TValue::FLOATVAR) 
     315        raiseError("attribute '%s' is not continuous", var->name.c_str()); 
     316 
     317      const int pos = domain.getVarNum(var); 
    314318      ps.push_back(pair<int, float>(pos, (*vi).second)); 
    315319 
     
    319323   
    320324  if (defaultDeviation) { 
    321     TVarList::const_iterator vi(domain.variables->begin()); 
     325    TVarList::const_iterator vi(domain.attributes->begin()); 
    322326    const vector<bool>::const_iterator bb = attributeUsed.begin(); 
    323327    const_ITERATE(vector<bool>, bi, attributeUsed) { 
     
    445449PExampleGenerator TPreprocessor_addGaussianClassNoise::operator()(PExampleGenerator gen, const int &weightID, int &newWeight) 
    446450{ 
    447   if (!gen->domain->classVar) 
     451  PVariable classVar = gen->domain->classVar; 
     452 
     453  if (!classVar) 
    448454    raiseError("Class-less domain"); 
     455  if (classVar->varType != TValue::FLOATVAR) 
     456    raiseError("Class '%s' is not continuous", gen->domain->classVar->name.c_str()); 
    449457 
    450458  newWeight = weightID; 
     
    734742TPreprocessor_discretize::TPreprocessor_discretize() 
    735743: attributes(), 
    736   notClass(true), 
     744  discretizeClass(false), 
    737745  method() 
    738746{} 
     
    741749TPreprocessor_discretize::TPreprocessor_discretize(PVarList attrs, const bool &nocl, PDiscretization meth) 
    742750: attributes(attrs), 
    743   notClass(nocl), 
     751  discretizeClass(nocl), 
    744752  method(meth) 
    745753{} 
     
    764772      idx++; 
    765773    } 
    766     if (!notClass && (domain.classVar->varType == TValue::FLOATVAR)) 
     774    if (discretizeClass && (domain.classVar->varType == TValue::FLOATVAR)) 
    767775      discretizeId.push_back(idx); 
    768776  } 
  • source/orange/preprocessors.hpp

    r234 r239  
    259259 
    260260  PVarList attributes; //P attributes to be discretized (all, if not defined or empty) 
    261   bool notClass; //P do not discretize the class attribute (default: true) 
     261  bool discretizeClass; //P also discretize the class attribute (default: false) 
    262262  PDiscretization method; //P discretization method 
    263263 
     
    265265 
    266266  TPreprocessor_discretize(); 
    267   TPreprocessor_discretize(PVarList, const bool & = true, PDiscretization = PDiscretization()); 
     267  TPreprocessor_discretize(PVarList, const bool & = false, PDiscretization = PDiscretization()); 
    268268  virtual PExampleGenerator operator()(PExampleGenerator generators, const int &weightID, int &newWeight); 
    269269}; 
  • source/orange/trindex.cpp

    r142 r239  
    219219PRandomIndices TMakeRandomIndicesN::operator()(const int &n, PFloatList ap) 
    220220{ if (!ap || !ap->size()) 
    221     raiseError("invalid (empty) vector of probabilities"); 
     221    raiseError("'p' not defined or empty"); 
     222 
     223  float sum = 0; 
     224  for(vector<float>::const_iterator pis(ap->begin()), pie(ap->end()); pis!=pie; sum += (*(pis++))); 
     225  if (sum>=1.0) 
     226    raiseError("elements of 'p' sum to 1 or more"); 
     227 
    222228  if (stratified==TMakeRandomIndices::STRATIFIED) 
    223229    raiseError("stratification not implemented"); 
Note: See TracChangeset for help on using the changeset viewer.