half ram support

This commit is contained in:
tqchen
2015-04-19 21:29:13 -07:00
parent 5ad1555daf
commit dfec406afd
3 changed files with 32 additions and 7 deletions

View File

@@ -66,10 +66,16 @@ DataMatrix* LoadDataMatrix(const char *fname,
dmat->LoadBinary(fs, silent, cache_file);
fs.Close();
return dmat;
} else {
DMatrixPage *dmat = new DMatrixPage();
dmat->LoadText(fname, cache_file, false, loadsplit);
return dmat;
} else {
if (fname[0] == '!') {
DMatrixHalfRAM *dmat = new DMatrixHalfRAM();
dmat->LoadText(fname + 1, cache_file, false, loadsplit);
return dmat;
} else {
DMatrixPage *dmat = new DMatrixPage();
dmat->LoadText(fname, cache_file, false, loadsplit);
return dmat;
}
}
}
}

View File

@@ -224,6 +224,25 @@ class DMatrixPage : public DMatrixPageBase<0xffffab02> {
/*! \brief the real fmatrix */
FMatrixPage *fmat_;
};
// mix of FMatrix S and DMatrix
// cost half of ram usually as DMatrixSimple
class DMatrixHalfRAM : public DMatrixPageBase<0xffffab03> {
public:
DMatrixHalfRAM(void) {
fmat_ = new FMatrixS(iter_);
}
virtual ~DMatrixHalfRAM(void) {
delete fmat_;
}
virtual IFMatrix *fmat(void) const {
return fmat_;
}
virtual void set_cache_file(const std::string &cache_file) {
}
/*! \brief the real fmatrix */
IFMatrix *fmat_;
};
} // namespace io
} // namespace xgboost
#endif // XGBOOST_IO_PAGE_ROW_ITER_INL_HPP_