Skip to content

Commit

Permalink
Merge pull request #8 from RobBa/Dev/create_inputdata_immidiatly
Browse files Browse the repository at this point in the history
Make inputdata object earlier available when starting active learning.
  • Loading branch information
RobBa authored Apr 15, 2024
2 parents cb7d004 + df06d19 commit 56a8ada
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions source/active_learning/active_learning_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,13 @@ std::unique_ptr<parser> active_learning_main_func::get_parser(ifstream& input_st
}
}

inputdata active_learning_main_func::get_inputdata() const {
inputdata* active_learning_main_func::get_inputdata() const {
ifstream input_stream = get_inputstream();

inputdata id;
inputdata_locator::provide(&id);
inputdata* id = inputdata_locator::get();

auto input_parser = get_parser(input_stream);
id.read(input_parser.get());
id->read(input_parser.get());
input_stream.close();
return id;
}
Expand Down Expand Up @@ -133,6 +132,8 @@ unique_ptr<eq_oracle_base> active_learning_main_func::select_oracle_class(shared
*
*/
void active_learning_main_func::run_active_learning() {
inputdata id;
inputdata_locator::provide(&id);
assertm(ENSEMBLE_RUNS > 0, "nruns parameter must be larger than 0 for active learning.");

// Setting some initialization for learning from SQLDB.
Expand Down Expand Up @@ -194,14 +195,12 @@ void active_learning_main_func::run_active_learning() {

if (ACTIVE_SUL) {
LOG_S(INFO) << "We do not want to run the input file, alphabet and input data must be inferred from SUL.";
inputdata id;
inputdata_locator::provide(&id);

sul->pre(id);
algorithm->run(id);
} else {
LOG_S(INFO) << "We only want to read the inputdata when we learn passively or from sequences.";
inputdata id = get_inputdata();
get_inputdata();

sul->pre(id);
algorithm->run(id);
Expand Down
2 changes: 1 addition & 1 deletion source/active_learning/active_learning_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <memory>
class active_learning_main_func {
private:
inputdata get_inputdata() const;
inputdata* get_inputdata() const;
ifstream get_inputstream() const;
std::unique_ptr<parser> get_parser(ifstream& input_stream) const;
unique_ptr<psql::db> my_sqldb;
Expand Down

0 comments on commit 56a8ada

Please sign in to comment.