只是想让我了解Boost Graph库,我有几个问题。我正在写一些代码,它是围绕BGL图的包装器类。我的想法是,我可以随意操作图形,然后调用包装器方法以GEXF(XML)格式输出图形。
我的代码是这样的:
struct Vertex {
std::string label;
...
};
struct Edge {
std::string label;
double weight;
...
};
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, Vertex, Edge> GraphType;
template <typename Graph>
class GEXF
{
private:
Graph graph;
...
};
template <typename Graph>
void GEXF<Graph>::buildXML()
{
...
// output the edges
property_map<adjacency_list<>, edge_index_t>::type edge_id = get(edge_index, graph);
GraphType::edge_iterator e, e_end;
for(tie(e, e_end) = edges(graph); e != e_end; ++e)
{
xmlpp::Element *edge = ePtr->add_child("edge");
// next line gives an error, property not found
edge->set_attribute("id", …Run Code Online (Sandbox Code Playgroud) 我编写了自己的LOF实现,并且我试图将结果与ELKI和RapidMiner中的实现进行比较,但所有3都给出了不同的结果!我想弄清楚为什么.
我的参考数据集是一维的,102个实数值,有许多重复.我会尝试在下面发布.
首先,RapidMiner实现.LOF分数与ELKI和我的结果大不相同; 许多人带着无穷大的LOF回来.此实施是否已经过验证是正确的?
我的结果与ELKI类似,但我没有得到完全相同的LOF值.通过快速扫描ELKI源代码中的注释,我认为这可能是因为计算k邻域的方式不同.
在LOF文件中,MinPts参数(在别处称为k)指定最小值.要包括在k-neighborhood中的点数.在ELKI实现中,我认为他们将k邻域定义为k个点而不是k距离或k个不同距离内的所有点.任何人都可以确切地确认ELKI如何构建k-neighborhood?还有一个私有变量允许点本身包含在它自己的邻域中,但看起来默认不包括它.
有没有人知道一个公共参考数据集,其中附有LOF分数用于验证目的?
---更多细节如下---
参考:ELKI源代码在这里:
http://elki.dbs.ifi.lmu.de/browser/elki/trunk/src/de/lmu/ifi/dbs/elki/algorithm/outlier/lof/LOF.java
RapidMiner源代码在这里:
这是我的测试数据集:
4.32323 5.12595 5.12595 5.12595 5.12595 5.7457 5.7457 5.7457 5.7457 5.7457 5.7457 5.97766 5.97766 6.07352 6.07352 6.12015 6.12015 6.12015 6.44797 6.44797 6.48131 6.48131 6.48131 6.48131 6.48131 6.48131 6.6333 6.6333 6.6333 6.70872 6.70872 6.70872 6.70872 6.70872 6.77579 6.77579 6.77579 6.77579 6.77579 6.77579 6.77579 6.77579 6.77579 6.77579 6.77579 6.77579 6.77579 6.77579 6.77579 7.03654 7.03654 7.03654 7.03654 7.03654 7.03654 7.03654 7.03654 7.03654 7.03654 7.03654 7.03654 7.03654 7.03654 7.03654 7.10361 7.10361 7.10361 …