"...transform/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "03024f9587d1bf9b577b56c51e745cb3af502f0a"
Commit 3969b181 authored by Davis King's avatar Davis King
Browse files

Changed the code so that the manifold regularizer is normalized by the number of edges

involved in its creation.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403598
parent a8971105
...@@ -195,6 +195,8 @@ namespace dlib ...@@ -195,6 +195,8 @@ namespace dlib
impl::undirected_adjacency_list graph; impl::undirected_adjacency_list graph;
graph.build(edges, weight_funct); graph.build(edges, weight_funct);
num_edges = edges.size();
make_mr_matrix(samples, graph); make_mr_matrix(samples, graph);
} }
...@@ -208,8 +210,13 @@ namespace dlib ...@@ -208,8 +210,13 @@ namespace dlib
if (dimensionality() == 0) if (dimensionality() == 0)
return general_matrix(); return general_matrix();
// TODO: should we divide intrinsic_regularization_strength by the number of edges? That maybe a more
// reasonable interface. // This isn't how it's defined in the referenced paper but normalizing these kinds of
// sums is typical of most machine learning algorithms. Moreover, doing this makes
// the argument to this function more invariant to the size of the edge set. So it
// should make it easier for the user.
intrinsic_regularization_strength /= num_edges;
return inv_lower_triangular(chol(identity_matrix<scalar_type>(reg_mat.nr()) + intrinsic_regularization_strength*reg_mat)); return inv_lower_triangular(chol(identity_matrix<scalar_type>(reg_mat.nr()) + intrinsic_regularization_strength*reg_mat));
} }
...@@ -269,6 +276,7 @@ namespace dlib ...@@ -269,6 +276,7 @@ namespace dlib
} }
general_matrix reg_mat; general_matrix reg_mat;
unsigned long num_edges;
}; };
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment