Changeset 239:53be0d6610b1 in orange
- Timestamp:
- 09/04/03 22:21:25 (10 years ago)
- Branch:
- default
- Convert:
- 4f3dace9ea69b9e159ec40084111ebe4fc20a4cf
- Location:
- source
- Files:
-
- 9 edited
-
Orange.dsp (modified) (2 diffs)
-
include.dsp (modified) (1 diff)
-
orange/cls_example.cpp (modified) (1 diff)
-
orange/distvars.cpp (modified) (4 diffs)
-
orange/distvars.hpp (modified) (3 diffs)
-
orange/lib_kernel.cpp (modified) (2 diffs)
-
orange/preprocessors.cpp (modified) (6 diffs)
-
orange/preprocessors.hpp (modified) (2 diffs)
-
orange/trindex.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
source/Orange.dsp
r191 r239 58 58 # Begin Special Build Tool 59 59 SOURCE="$(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" 60 PostBuild_Desc=UPXing Orange 61 PostBuild_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" 61 62 # End Special Build Tool 62 63 … … 740 741 # Begin Source File 741 742 742 SOURCE=.\orange\linreg.cpp743 # End Source File744 # Begin Source File745 746 743 SOURCE=.\orange\lookup.cpp 747 744 -
source/include.dsp
r166 r239 100 100 # Begin Source File 101 101 102 SOURCE=.\include\Nrutil.cpp103 # End Source File104 # Begin Source File105 106 102 SOURCE=.\include\primes.c 107 103 # End Source File 108 104 # Begin Source File 109 105 110 SOURCE=.\include\pythag.cpp111 # End Source File112 # Begin Source File113 114 106 SOURCE=.\include\statexceptions.cpp 115 # End Source File116 # Begin Source File117 118 SOURCE=.\include\svbksb.cpp119 # End Source File120 # Begin Source File121 122 SOURCE=.\include\svdcmp.cpp123 107 # End Source File 124 108 # End Group -
source/orange/cls_example.cpp
r234 r239 295 295 int index = (int)PyInt_AsLong(pyindex); 296 296 297 if ( !index)297 if (index>0) 298 298 PYERROR(PyExc_IndexError, "Example.setweight: invalid weight id", PYNULL); 299 299 -
source/orange/distvars.cpp
r234 r239 201 201 NOT_IMPLEMENTED("percentile(float)") 202 202 203 float TDistribution:: density(const float &) const204 NOT_IMPLEMENTED(" density(float)")203 float TDistribution::p(const float &) const 204 NOT_IMPLEMENTED("p(float)") 205 205 206 206 … … 321 321 } 322 322 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)); 324 324 } 325 325 … … 1112 1112 } 1113 1113 1114 float TContDistribution:: density(const float &x) const1114 float TContDistribution::p(const float &x) const 1115 1115 { const_iterator rb = upper_bound(x); 1116 1116 if (rb==end()) … … 1183 1183 1184 1184 1185 float TGaussianDistribution:: density(const float &x) const1185 float TGaussianDistribution::p(const float &x) const 1186 1186 { return abs * exp(-sqr((x-mean)/2/sigma)) / (sigma*sqrt(2*pi)); } 1187 1187 -
source/orange/distvars.hpp
r234 r239 110 110 virtual float percentile(const float &) const; 111 111 virtual float error() const; 112 virtual float density(const float &) const;112 virtual float p(const float &) const; 113 113 114 114 /* The below methods may be redefined (they are not implemented in TDistribution) */ … … 226 226 virtual void addfloat(const float &f, const float &w = 1.0); 227 227 virtual void setfloat(const float &v, const float &w); 228 virtual float density(const float &) const;228 virtual float p(const float &) const; 229 229 230 230 virtual float average() const; … … 263 263 virtual float randomFloat() const; 264 264 265 virtual float density(const float &) const;265 virtual float p(const float &) const; 266 266 virtual bool noDeviation() const; 267 267 }; -
source/orange/lib_kernel.cpp
r234 r239 2686 2686 return PYNULL; 2687 2687 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! 2694 PyObject *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)); 2689 2702 PyCATCH 2690 2703 } … … 2744 2757 return PYNULL; 2745 2758 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! 2764 PyObject *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)); 2747 2771 PyCATCH 2748 2772 } -
source/orange/preprocessors.cpp
r234 r239 311 311 if (deviations) 312 312 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); 314 318 ps.push_back(pair<int, float>(pos, (*vi).second)); 315 319 … … 319 323 320 324 if (defaultDeviation) { 321 TVarList::const_iterator vi(domain. variables->begin());325 TVarList::const_iterator vi(domain.attributes->begin()); 322 326 const vector<bool>::const_iterator bb = attributeUsed.begin(); 323 327 const_ITERATE(vector<bool>, bi, attributeUsed) { … … 445 449 PExampleGenerator TPreprocessor_addGaussianClassNoise::operator()(PExampleGenerator gen, const int &weightID, int &newWeight) 446 450 { 447 if (!gen->domain->classVar) 451 PVariable classVar = gen->domain->classVar; 452 453 if (!classVar) 448 454 raiseError("Class-less domain"); 455 if (classVar->varType != TValue::FLOATVAR) 456 raiseError("Class '%s' is not continuous", gen->domain->classVar->name.c_str()); 449 457 450 458 newWeight = weightID; … … 734 742 TPreprocessor_discretize::TPreprocessor_discretize() 735 743 : attributes(), 736 notClass(true),744 discretizeClass(false), 737 745 method() 738 746 {} … … 741 749 TPreprocessor_discretize::TPreprocessor_discretize(PVarList attrs, const bool &nocl, PDiscretization meth) 742 750 : attributes(attrs), 743 notClass(nocl),751 discretizeClass(nocl), 744 752 method(meth) 745 753 {} … … 764 772 idx++; 765 773 } 766 if ( !notClass && (domain.classVar->varType == TValue::FLOATVAR))774 if (discretizeClass && (domain.classVar->varType == TValue::FLOATVAR)) 767 775 discretizeId.push_back(idx); 768 776 } -
source/orange/preprocessors.hpp
r234 r239 259 259 260 260 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) 262 262 PDiscretization method; //P discretization method 263 263 … … 265 265 266 266 TPreprocessor_discretize(); 267 TPreprocessor_discretize(PVarList, const bool & = true, PDiscretization = PDiscretization());267 TPreprocessor_discretize(PVarList, const bool & = false, PDiscretization = PDiscretization()); 268 268 virtual PExampleGenerator operator()(PExampleGenerator generators, const int &weightID, int &newWeight); 269 269 }; -
source/orange/trindex.cpp
r142 r239 219 219 PRandomIndices TMakeRandomIndicesN::operator()(const int &n, PFloatList ap) 220 220 { 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 222 228 if (stratified==TMakeRandomIndices::STRATIFIED) 223 229 raiseError("stratification not implemented");
Note: See TracChangeset
for help on using the changeset viewer.
