-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mainly : adding ContinuousBayesianNetwork and ContinuousPC::learnJunc…
…tionTree
- Loading branch information
1 parent
4c359ce
commit 897085b
Showing
30 changed files
with
730 additions
and
550 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
|
||
add_subdirectory ( include ) | ||
add_subdirectory ( src ) | ||
add_subdirectory ( test ) | ||
|
||
install ( FILES ${HEADERFILES} | ||
DESTINATION ${OTAGRUM_INCLUDE_PATH}/${PACKAGE_NAME} | ||
DESTINATION ${OTAGRUM_INCLUDE_PATH}/${PACKAGE_NAME} | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// -*- C++ -*- | ||
/** | ||
* @brief ContinuousPC | ||
* | ||
* Copyright 2010-2019 Airbus-LIP6-Phimeca | ||
* | ||
* This library is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#include <algorithm> | ||
#include <vector> | ||
|
||
#include "otagrum/ContinuousBayesianNetwork.hxx" | ||
#include "otagrum/Utils.hxx" | ||
|
||
namespace OTAGRUM | ||
{ | ||
ContinuousBayesianNetwork::ContinuousBayesianNetwork( | ||
const gum::BayesNet<double> &bn) | ||
: dag_(bn.dag()), map_(bn.size()) | ||
{ | ||
std::transform(bn.nodes().begin(), bn.nodes().end(), map_.begin(), | ||
[&bn](const gum::NodeId nod) -> std::string | ||
{ | ||
return bn.variable(nod).name(); | ||
}); | ||
} | ||
|
||
ContinuousBayesianNetwork::ContinuousBayesianNetwork( | ||
const gum::DAG &dag, const std::vector<std::string> &names) | ||
: dag_(dag), map_(dag.size()) | ||
{ | ||
for (const auto &name : names) | ||
{ | ||
map_.add(name); | ||
} | ||
} | ||
|
||
OT::UnsignedInteger ContinuousBayesianNetwork::getSize() const | ||
{ | ||
return map_.getSize(); | ||
} | ||
|
||
OT::Description ContinuousBayesianNetwork::getDescription() const | ||
{ | ||
return map_; | ||
} | ||
|
||
OT::Indices ContinuousBayesianNetwork::getParents(const gum::NodeId nod) const | ||
{ | ||
return Utils::FromNodeSet(dag_.parents(nod)); | ||
} | ||
|
||
OT::Indices | ||
ContinuousBayesianNetwork::getChildren(const gum::NodeId nod) const | ||
{ | ||
return Utils::FromNodeSet(dag_.children(nod)); | ||
} | ||
|
||
OT::Indices ContinuousBayesianNetwork::getNodes() const | ||
{ | ||
return Utils::FromNodeSet(dag_.nodes().asNodeSet()); | ||
} | ||
} // namespace OTAGRUM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// -*- C++ -*- | ||
/** | ||
* @brief ContinuousBayesianNetworks | ||
* | ||
* Copyright 2010-2019 Airbus-LIP6-Phimeca | ||
* | ||
* This library is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#ifndef OTAGRUM_CONTINUOUSBAYESIANNETWORK_HXX | ||
#define OTAGRUM_CONTINUOUSBAYESIANNETWORK_HXX | ||
#include <string> | ||
#include <vector> | ||
|
||
#include <agrum/BN/BayesNet.h> | ||
#include <agrum/graphs/DAG.h> | ||
|
||
#include <openturns/Description.hxx> | ||
#include <openturns/Indices.hxx> | ||
|
||
#include "otagrum/otagrumprivate.hxx" | ||
|
||
namespace OTAGRUM | ||
{ | ||
class OTAGRUM_API ContinuousBayesianNetwork : public OT::Object | ||
{ | ||
public: | ||
ContinuousBayesianNetwork() = delete; | ||
ContinuousBayesianNetwork(const gum::BayesNet<double> &bn); | ||
ContinuousBayesianNetwork(const gum::DAG &dag, | ||
const std::vector<std::string> &names); | ||
|
||
OT::UnsignedInteger getSize() const; | ||
OT::Description getDescription() const; | ||
|
||
OT::Indices getParents(const gum::NodeId nod) const; | ||
OT::Indices getChildren(const gum::NodeId nod) const; | ||
OT::Indices getNodes() const; | ||
|
||
private: | ||
gum::DAG dag_; | ||
OT::Description map_; | ||
}; | ||
|
||
} // namespace OTAGRUM | ||
#endif // OTAGRUM_CONTINUOUSBAYESIANNETWORK_HXX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.