void TestWidget::test() { resize(800,600); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); logOld->clearLog(); logOld->close_logfile(); if (QFile::exists("oldlogwidget.log")) QFile::remove("oldlogwidget.log"); logOld->open_logfile("oldlogwidget.log", false); log2->clearLog(); log2->close_logfile(); if (QFile::exists("logwidget2.log")) QFile::remove("logwidget2.log"); log2->open_logfile("logwidget2.log"); testLogs(logOld, labResultsOld, 0, 10); testLogs(log2, labResults2 , 0, 10); testLogs(logOld, labResultsOld, 10, 100); testLogs(log2, labResults2 , 10, 100); testLogs(logOld, labResultsOld, 100, 1000); testLogs(log2, labResults2 , 100, 1000); testLogs(logOld, labResultsOld, 1000, 10000); testLogs(log2, labResults2 , 1000, 10000); QApplication::restoreOverrideCursor(); }
int main() { testSequence2(); return 0; testSequenceCMAES(); return 0; testSequence(); return 0; testLogs(); return 0; //Plot real target function Leph::Plot plot; for (double x=0.0;x<=1.0;x+=0.03) { for (double y=0.0;y<=1.0;y+=0.03) { plot.add(Leph::VectorLabel( "x", x, "y", y, "real", function(x, y))); } } //Initialize Gaussian Process libgp::GaussianProcess gp(2, "CovSum ( CovSEiso, CovNoise)"); //Adding noised data point to model for (size_t k=0;k<100;k++) { double x = 0.5*uniform(generator) + 0.5; double y = 0.5*uniform(generator) + 0.5; double f = function(x, y) + noise(1.0); plot.add(Leph::VectorLabel( "x", x, "y", y, "target", f)); double input[] = {x, y}; gp.add_pattern(input, f); } //Optimize hyper parameter libgp::RProp rprop; rprop.init(); rprop.maximize(&gp, 50, true); //Predict fitted model for (double x=0.0;x<=1.0;x+=0.04) { for (double y=0.0;y<=1.0;y+=0.04) { double input[] = {x, y}; plot.add(Leph::VectorLabel( "x", x, "y", y, "fitted", gp.f(input))); } } //Display plot plot.plot("x", "y", "all").render(); return 0; }