This commit is contained in:
Garry Boyer
2007-06-07 22:35:33 +00:00
parent aff6b634ae
commit d7ea99995c
6 changed files with 25 additions and 11 deletions
+5 -3
View File
@@ -267,7 +267,7 @@ class AffinityAlpha {
void Postprocess(const Param& param,
const QPoint& q, index_t q_index, const RNode& r_root) {}
void ApplyPostponed(const Param& param,
const QPostponed& postponed, const QPoint& q) {}
const QPostponed& postponed, const QPoint& q, index_t q_i) {}
};
struct QMassResult {
@@ -490,7 +490,7 @@ class AffinityRho {
rho += self_responsibility;
}
void ApplyPostponed(const Param& param,
const QPostponed& postponed, const QPoint& q) {
const QPostponed& postponed, const QPoint& q, index_t q_index) {
#ifdef APPRLX
rho += postponed.d_rho;
error_buffer += postponed.error_buffer;
@@ -817,6 +817,7 @@ void TimeStats(datanode *module, const ArrayList<double>& list) {
fx_format_result(module, "med", "%f", v_med/1e6);
fx_format_result(module, "max", "%f", v_max/1e6);
fx_format_result(module, "avg", "%f", v_avg/1e6);
fx_format_result(module, "sum", "%f", v_avg*list.size()/1e6);
}
@@ -864,7 +865,7 @@ void AffinityMain(datanode *module, const char *gnp_name) {
point->info().alpha.max1 = 0;
point->info().alpha.max2 = param.pref;
point->info().alpha.max1_index = i;
if (rand() % 16 == 0) {
if (rand() % 2 == 0) {
point->info().rho = -param.pref / 2;
} else {
point->info().rho = 0;
@@ -1044,6 +1045,7 @@ void AffinityMain(datanode *module, const char *gnp_name) {
iter_times_alpha);
TimeStats(fx_submodule(module, "iter_times_total", "iter_times_total"),
iter_times_total);
fx_format_result(module, "n_points", "%"LI"d", n_points);
// This will take too long if there are too many exemplars.
if (n_exemplars >= 10000) {
+7
View File
@@ -276,6 +276,7 @@ int main (int argc, char **argv)
}
}
fx_timer_stop(fx_root, "all_iter");
/* If clusters were identified, find the assignments and output them */
if (K > 0) {
for (j = 0; j < m; j++)
@@ -349,6 +350,12 @@ int main (int argc, char **argv)
fprintf (stderr, " Similarities of data points to exemplars: %f\n", dpsim);
fprintf (stderr, " Preferences of selected exemplars: %f\n", expref);
fprintf (stderr, "Number of iterations: %d\n\n", it);
struct timer *timer_all_iter = fx_timer(fx_root, "all_iter");
fx_format_result(fx_root, "n_points", "%ld", n);
fx_format_result(fx_root, "avg", "%f", timer_all_iter->total.micros / 1.0e6 / it);
fx_format_result(fx_root, "n_iterations", "%d", it);
fx_format_result(fx_root, "netsim", "%f", netsim);
}
else
fprintf (stderr, "\nDid not identify any clusters\n");
+4
View File
@@ -32,6 +32,10 @@ binrule(name = "allnn",
sources = ["allnn.cc"],
deplibs = [":nbr"])
binrule(name = "tpc",
sources = ["tpc.cc"],
deplibs = [":nbr"])
binrule(name = "affinity",
sources = ["affinity.cc"],
deplibs = [":nbr"])
+2 -2
View File
@@ -184,7 +184,7 @@ void DualTreeDepthFirst<GNP>::PushDown_(
typename GNP::QResult *q_result = q_results_.StartWrite(q_i);
const typename GNP::QPoint *q_point = q_points_.StartRead(q_i);
q_result->ApplyPostponed(param_, q_node_mut->postponed, *q_point);
q_result->ApplyPostponed(param_, q_node_mut->postponed, *q_point, q_i);
q_result->Postprocess(param_, *q_point, q_i, *r_root_);
q_results_.StopWrite(q_i);
q_points_.StopRead(q_i);
@@ -354,7 +354,7 @@ void DualTreeDepthFirst<GNP>::BaseCase_(
const typename GNP::QPoint *q_point = q_iter;
typename GNP::QResult *q_result = q_results_.StartWrite(q_i);
q_result->ApplyPostponed(param_, q_node_mut->postponed, *q_point);
q_result->ApplyPostponed(param_, q_node_mut->postponed, *q_point, q_i);
if (visitor.StartVisitingQueryPoint(param_, *q_point, q_i, *r_node,
exclusive_unvisited, q_result, &global_result_)) {
+5 -6
View File
@@ -47,18 +47,16 @@ struct BlankQResult {
public:
OT_DEF(BlankQResult) {}
public:
template<typename Param, typename Point, typename RNode>
void Init(const Param& param,
const Point& q_point,
const RNode& r_root) {}
template<typename Param>
void Init(const Param& param) {}
template<typename Param, typename Point, typename RNode>
void Postprocess(const Param& param,
const Point& q_point,
const Point& q_point, index_t q_index,
const RNode& r_root) {}
template<typename Param, typename QPostponed, typename Point>
void ApplyPostponed(const Param& param,
const QPostponed& postponed,
const Point& q_point) {}
const Point& q_point, index_t q_index) {}
};
class BlankGlobalResult {
@@ -75,6 +73,7 @@ class BlankGlobalResult {
void UndoDelta(const Param& param, const Delta& delta) {}
template<typename Param>
void Postprocess(const Param& param) {}
void Report(datanode *datanode) {}
};
struct BlankQMassResult {
+2
View File
@@ -198,6 +198,8 @@ class ThreadedDualTreeSolver {
}
fx_timer_stop(module, "all_threads");
global_result_.Report(fx_submodule(module, NULL, "global_result"));
}
};