Git Product home page Git Product logo

randomforests's Issues

bug in sample.cpp

void Sample::randomSelectFeature(int*featureIndex,int featureNum,int selectedFeatureNum)
{
// ......
for(i=0,j=featureNum-selectedFeatureNum;j<featureNum;++j,++i)
{
// if featureNum == selectedFeatureNum, then wrong
index = rand()%j;
// ......
}
so, may be like this:
if(j == 0)
index = 0;
else
index = rand()%j;

have a question about Sample Class

Sample::Sample(Sample* samples)
{
_dataset=samples->_dataset;
_labels=samples->_labels;
_classNum=samples->getClassNum();
_featureNum=samples->getFeatureNum();
_sampleNum=samples->getSampleNum();
_selectedSampleNum=samples->getSelectedSampleNum();
_selectedFeatureNum=samples->getSelectedFeatureNum();
_sampleIndex=samples->getSampleIndex();
_featureIndex=samples->getFeatureIndex();
}
Sample::~Sample()
{
_sampleIndex=NULL;
_featureIndex=NULL;
}
Is it safe to write this way

发现一个bug

我在win10设备上运行代码,用VS2019创建工程,使用的数据集是您推荐的数据集。但是把编译器配置成release-x64,debug-x64和debug-x86的时候都运行不了,弹出以下错误:
C:\Users\lenovo\Desktop\rf\rf\Debug\rf.exe (进程 20548)已退出,代码为 -1073741819。
debug发现在文件node.cpp-69行处发生内存冲突:
0x01314AD8 处(位于 rf.exe 中)引发的异常: 0xC0000005: 读取位置 0x993F48B0 时发生访问冲突。
只有配置成release-x86时可以跑通代码,给出正确结果。

bug-for- ~Tree()

Tree::~Tree()
{
if(_cartreeArray!=NULL)
{
for(int i=0;i<_nodeNum;++i)
{
if(_cartreeArray[i]!=NULL)
{
delete _cartreeArray[i];
_cartreeArray[i]=NULL;
}
}
delete[] _cartreeArray;
_cartreeArray=NULL;
}
}

error! about delete

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.