[opengm] 147/386: remove obsolete test datasets
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:36:38 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository opengm.
commit d74d2ac66d388f44b635e50ae66d9eb844d08d6c
Author: mschiegg <martin.schiegg at iwr.uni-heidelberg.de>
Date: Fri Dec 19 10:16:21 2014 +0100
remove obsolete test datasets
---
include/opengm/learning/dataset/testdataset.hxx | 96 ---------------------
include/opengm/learning/dataset/testdataset2.hxx | 103 -----------------------
2 files changed, 199 deletions(-)
diff --git a/include/opengm/learning/dataset/testdataset.hxx b/include/opengm/learning/dataset/testdataset.hxx
deleted file mode 100644
index f24eee0..0000000
--- a/include/opengm/learning/dataset/testdataset.hxx
+++ /dev/null
@@ -1,96 +0,0 @@
-
-//make it obsolet
-#define OPENGM_TESTDATASET_HXX
-
-
-#pragma once
-#ifndef OPENGM_TESTDATASET_HXX
-#define OPENGM_TESTDATASET_HXX
-
-#include <vector>
-#include <cstdlib>
-
-#include <opengm/functions/learnable/lpotts.hxx>
-
-namespace opengm {
- namespace datasets{
-
- template<class GM>
- class TestDataset{
- public:
- typedef GM GMType;
- typedef typename GM::ValueType ValueType;
- typedef typename GM::IndexType IndexType;
- typedef typename GM::LabelType LabelType;
- typedef opengm::learning::Weights<ValueType> Weights;
-
- const GM& getModel(const size_t i) const { return gms_[i]; }
- const std::vector<LabelType>& getGT(const size_t i) const { return gt_[i]; }
- Weights& getWeights() { return weights_; }
- size_t getNumberOfWeights() const { return 1; }
- size_t getNumberOfModels() const { return gms_.size(); }
-
- TestDataset(size_t numModels=10);
-
- private:
- std::vector<GM> gms_;
- std::vector<LabelType> gt_;
- Weights weights_;
- };
-
-
-
- template<class GM>
- TestDataset<GM>::TestDataset(size_t numModels)
- : weights_(Weights(1))
- {
- LabelType numberOfLabels = 2;
- gt_.resize(64*64,0);
- for(size_t i=32*64; i<64*64; ++i){
- gt_[i] = 1;
- }
- gms_.resize(numModels);
- for(size_t m=0; m<numModels; ++m){
- std::srand(m);
- for (int j = 0; j < 64*64; j++)
- gms_[m].addVariable(2);
- for(size_t y = 0; y < 64; ++y){
- for(size_t x = 0; x < 64; ++x) {
- // function
- const size_t shape[] = {numberOfLabels};
- ExplicitFunction<ValueType> f(shape, shape + 1);
- ValueType val = (double)(gt_[y*64+x]) + (double)(std::rand()) / (double) (RAND_MAX) * 1.5 - 0.75 ;
- f(0) = std::fabs(val-0);
- f(1) = std::fabs(val-1);
- typename GM::FunctionIdentifier fid = gms_[m].addFunction(f);
-
- // factor
- size_t variableIndices[] = {y*64+x};
- gms_[m].addFactor(fid, variableIndices, variableIndices + 1);
- }
- }
-
- opengm::functions::learnable::LPotts<ValueType,IndexType,LabelType> f(weights_,2,std::vector<size_t>(1,0),std::vector<ValueType>(1,1));
- typename GM::FunctionIdentifier fid = gms_[m].addFunction(f);
- for(size_t y = 0; y < 64; ++y){
- for(size_t x = 0; x < 64; ++x) {
- if(x + 1 < 64) { // (x, y) -- (x + 1, y)
- size_t variableIndices[] = {y*64+x, y*64+x+1};
- //sort(variableIndices, variableIndices + 2);
- gms_[m].addFactor(fid, variableIndices, variableIndices + 2);
- }
- if(y + 1 < 64) { // (x, y) -- (x, y + 1)
- size_t variableIndices[] = {y*64+x, (y+1)*64+x};
- //sort(variableIndices, variableIndices + 2);
- gms_[m].addFactor(fid, variableIndices, variableIndices + 2);
- }
- }
- }
- }
-
- };
-
- }
-} // namespace opengm
-
-#endif
diff --git a/include/opengm/learning/dataset/testdataset2.hxx b/include/opengm/learning/dataset/testdataset2.hxx
deleted file mode 100644
index 762158a..0000000
--- a/include/opengm/learning/dataset/testdataset2.hxx
+++ /dev/null
@@ -1,103 +0,0 @@
-
-//Make it obsolet
-#define OPENGM_TESTDATASET2_HXX
-
-#pragma once
-#ifndef OPENGM_TESTDATASET2_HXX
-#define OPENGM_TESTDATASET2_HXX
-
-#include <vector>
-#include <cstdlib>
-
-#include <opengm/functions/learnable/lpotts.hxx>
-#include <opengm/functions/learnable/sum_of_experts.hxx>
-
-namespace opengm {
- namespace datasets{
-
- template<class GM>
- class TestDataset2{
- public:
- typedef GM GMType;
- typedef typename GM::ValueType ValueType;
- typedef typename GM::IndexType IndexType;
- typedef typename GM::LabelType LabelType;
- typedef opengm::learning::Weights<ValueType> Weights;
-
- const GM& getModel(const size_t i)const { return gms_[i]; }
- const std::vector<LabelType>& getGT(const size_t i)const { return gt_; }
- Weights& getWeights() { return weights_; }
- size_t getNumberOfWeights()const { return 3; }
- size_t getNumberOfModels()const { return gms_.size(); }
-
- TestDataset2(size_t numModels=4);
-
- private:
- std::vector<GM> gms_;
- std::vector<LabelType> gt_;
- Weights weights_;
- };
-
-
-
- template<class GM>
- TestDataset2<GM>::TestDataset2(size_t numModels)
- : weights_(Weights(3))
- {
- LabelType numberOfLabels = 2;
- gt_.resize(64*64,0);
- for(size_t i=32*64; i<64*64; ++i){
- gt_[i] = 1;
- }
- gms_.resize(numModels);
- for(size_t m=0; m<numModels; ++m){
- std::srand(m);
- for (int j = 0; j < 64*64; j++)
- gms_[m].addVariable(2);
- for(size_t y = 0; y < 64; ++y){
- for(size_t x = 0; x < 64; ++x) {
- // function
- const size_t numExperts = 2;
- const std::vector<size_t> shape(1,numberOfLabels);
- std::vector<marray::Marray<ValueType> > feat(numExperts,marray::Marray<ValueType>(shape.begin(), shape.end()));
- ValueType val0 = (double)(gt_[y*64+x]) + (double)(std::rand()) / (double) (RAND_MAX) * 1.0 - 0.5 ;
- feat[0](0) = std::fabs(val0-0);
- feat[0](1) = std::fabs(val0-1);
- ValueType val1 = (double)(gt_[y*64+x]) + (double)(std::rand()) / (double) (RAND_MAX) * 2.0 - 1.0 ;
- feat[1](0) = std::fabs(val1-0);
- feat[1](1) = std::fabs(val1-1);
- std::vector<size_t> wID(2);
- wID[0]=1; wID[1]=2;
- opengm::functions::learnable::SumOfExperts<ValueType,IndexType,LabelType> f(shape,weights_, wID, feat);
- typename GM::FunctionIdentifier fid = gms_[m].addFunction(f);
-
- // factor
- size_t variableIndices[] = {y*64+x};
- gms_[m].addFactor(fid, variableIndices, variableIndices + 1);
- }
- }
-
- opengm::functions::learnable::LPotts<ValueType,IndexType,LabelType> f(weights_,2,std::vector<size_t>(1,0),std::vector<ValueType>(1,1));
- typename GM::FunctionIdentifier fid = gms_[m].addFunction(f);
- for(size_t y = 0; y < 64; ++y){
- for(size_t x = 0; x < 64; ++x) {
- if(x + 1 < 64) { // (x, y) -- (x + 1, y)
- size_t variableIndices[] = {y*64+x, y*64+x+1};
- //sort(variableIndices, variableIndices + 2);
- gms_[m].addFactor(fid, variableIndices, variableIndices + 2);
- }
- if(y + 1 < 64) { // (x, y) -- (x, y + 1)
- size_t variableIndices[] = {y*64+x, (y+1)*64+x};
- //sort(variableIndices, variableIndices + 2);
- gms_[m].addFactor(fid, variableIndices, variableIndices + 2);
- }
- }
- }
- }
-
- };
-
- }
-} // namespace opengm
-
-#endif
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opengm.git
More information about the debian-science-commits
mailing list