Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to libmf 2.01 #2

Merged
merged 62 commits into from
Jul 11, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
77b45bb
avoid crashes
yixuan May 5, 2016
6cfac01
import from libmf 2.01
yixuan May 5, 2016
be723d8
unneeded function
yixuan May 7, 2016
eea05d1
additinoal headers and macros
yixuan May 7, 2016
160fafc
fallback implementation of aligned memory allocation
yixuan May 7, 2016
108cb84
use R's RNG
yixuan May 8, 2016
29f38ea
use R's printing functions
yixuan May 8, 2016
26f3830
data reader
yixuan Jun 28, 2016
6278364
remove data reading code
yixuan Jun 29, 2016
13cb287
separate header file
yixuan Jun 29, 2016
9cccd4d
remove duplicated code
yixuan Jun 29, 2016
7a42321
model training
yixuan Jun 29, 2016
c1132d5
argument names
yixuan Jun 29, 2016
6d70119
model tuning
yixuan Jun 29, 2016
d1fedfa
upcoming news
yixuan Jun 29, 2016
5a175ce
get reader from R object
yixuan Jun 29, 2016
c5bda37
describe data source
yixuan Jun 29, 2016
224a5f7
virtual destructor
yixuan Jun 29, 2016
bf38713
getting data reader
yixuan Jun 29, 2016
e5d7386
use S4
yixuan Jun 29, 2016
4a3f1f7
make train() to work
yixuan Jun 29, 2016
c4a707d
make tune() to work
yixuan Jun 30, 2016
d313752
formatting
yixuan Jun 30, 2016
36333d5
documentation for train()
yixuan Jun 30, 2016
3442d62
update documentation for tune()
yixuan Jun 30, 2016
4482978
reference
yixuan Jul 2, 2016
2093bdb
documentation for data source
yixuan Jul 2, 2016
450d174
no longer needed
yixuan Jul 3, 2016
346d487
output format
yixuan Jul 4, 2016
aef401e
rename function
yixuan Jul 4, 2016
6339b67
code to export model
yixuan Jul 5, 2016
50bdc4e
R code for export()
yixuan Jul 6, 2016
c9b4498
proper way to read meta information
yixuan Jul 6, 2016
d5f7fe4
typo
yixuan Jul 6, 2016
519f4dd
private => protected
yixuan Jul 6, 2016
f08edd8
export functions
yixuan Jul 6, 2016
bb7de45
new code for predict()
Jul 6, 2016
e3b9d50
update R code
yixuan Jul 6, 2016
65c0f6b
documentation update
yixuan Jul 7, 2016
4e3ebb5
remove trailing space
yixuan Jul 7, 2016
5156a9d
documentation for predict()
yixuan Jul 7, 2016
188217a
header guards
yixuan Jul 8, 2016
4d10251
do not need data frame
yixuan Jul 9, 2016
19005b8
Merge branch 'libmf2.01' of https://github.com/yixuan/recosystem into…
yixuan Jul 10, 2016
089d52d
is_valid() is not so meaningful, removed
yixuan Jul 10, 2016
e1c2b38
refine documentation
yixuan Jul 10, 2016
d2da707
export data_memory()
yixuan Jul 10, 2016
7f5f805
update script to simulate data
yixuan Jul 10, 2016
402bfcc
use new function
yixuan Jul 10, 2016
afba586
reader of data in memory
yixuan Jul 10, 2016
6f5e7f1
typo
yixuan Jul 10, 2016
207a67b
add example for data_memory()
yixuan Jul 10, 2016
d710724
in-memory reader for testing data
yixuan Jul 10, 2016
dabb57c
add example
yixuan Jul 10, 2016
d0c0ea8
package information
yixuan Jul 10, 2016
acb1e25
update Rd files
yixuan Jul 10, 2016
11bac94
NEWS
yixuan Jul 10, 2016
2db7ec5
update code and formula in vignette
yixuan Jul 10, 2016
84ab5ec
updates on vignette
yixuan Jul 11, 2016
af96b2b
invisible NULL
yixuan Jul 11, 2016
f6e4218
refine vignette
yixuan Jul 11, 2016
3b8d612
README updates
yixuan Jul 11, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
get reader from R object
  • Loading branch information
yixuan committed Jun 29, 2016
commit 5a175ceb4d331b94d62f53fc25534907ca43cde1
21 changes: 21 additions & 0 deletions src/reco-read-data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

using namespace mf;

// DataSource.R
DataReader* get_reader(SEXP data_source)
{
Rcpp::RObject ds(data_source);
std::string ds_class = ds.attr("class");
Rcpp::List ds_list(data_source);

DataReader* res = nullptr;

if(ds_class == "DataFile")
{
std::string path = Rcpp::as<std::string>(ds_list["path"]);
bool index1 = Rcpp::as<bool>(ds_list["index1"]);
res = new DataFileReader(path, index1);
} else {
Rcpp::stop("unsupported data source");
}

return res;
}

// An mf_problem stands for a data object
mf_problem read_data(DataReader* reader)
{
Expand Down
10 changes: 6 additions & 4 deletions src/reco-read-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class DataReader
class DataFileReader: public DataReader
{
private:
std::string path;
int ind_offset;
std::ifstream in_file;
std::string line;
const std::string path;
const int ind_offset;
std::ifstream in_file;
std::string line;

public:
DataFileReader(const std::string& file_path, bool index1 = false) :
Expand Down Expand Up @@ -102,6 +102,8 @@ class DataFileReader: public DataReader
};


DataReader* get_reader(SEXP data_source);

mf::mf_problem read_data(DataReader* reader);


Expand Down