mirror of
https://github.com/nmap/nmap.git
synced 2026-02-03 20:16:33 +00:00
Update liblinear to 2.50
This commit is contained in:
@@ -1064,6 +1064,21 @@ static int solve_l2r_l1l2_svc(const problem *prob, const parameter *param, doubl
|
||||
info("Objective value = %lf\n",v/2);
|
||||
info("nSV = %d\n",nSV);
|
||||
|
||||
// Reconstruct w from the primal-dual relationship w=sum(\alpha_i y_i x_i)
|
||||
// This may reduce the weight density. Some zero weights become non-zeros
|
||||
// due to the numerical update w <- w + (alpha[i] - alpha_old) y_i x_i.
|
||||
if (param->w_recalc)
|
||||
{
|
||||
for(i=0; i<w_size; i++)
|
||||
w[i] = 0;
|
||||
for(i=0; i<l; i++)
|
||||
{
|
||||
feature_node * const xi = prob->x[i];
|
||||
if(alpha[i] > 0)
|
||||
sparse_operator::axpy(y[i]*alpha[i], xi, w);
|
||||
}
|
||||
}
|
||||
|
||||
delete [] QD;
|
||||
delete [] alpha;
|
||||
delete [] y;
|
||||
@@ -2194,11 +2209,14 @@ static int partition(feature_node *nodes, int low, int high)
|
||||
return index;
|
||||
}
|
||||
|
||||
// rearrange nodes so that nodes[:k] contains nodes with the k smallest values.
|
||||
// rearrange nodes so that
|
||||
// nodes[i] <= nodes[k] for all i < k
|
||||
// nodes[k] <= nodes[j] for all j > k
|
||||
// low and high are the bounds of the index range during the rearranging process
|
||||
static void quick_select_min_k(feature_node *nodes, int low, int high, int k)
|
||||
{
|
||||
int pivot;
|
||||
if(low == high)
|
||||
if(low == high || high < k)
|
||||
return;
|
||||
pivot = partition(nodes, low, high);
|
||||
if(pivot == k)
|
||||
@@ -3718,6 +3736,11 @@ const char *check_parameter(const problem *prob, const parameter *param)
|
||||
&& param->solver_type != L2R_L2LOSS_SVR)
|
||||
return "Initial-solution specification supported only for solvers L2R_LR, L2R_L2LOSS_SVC, and L2R_L2LOSS_SVR";
|
||||
|
||||
if(param->w_recalc == true
|
||||
&& param->solver_type != L2R_L2LOSS_SVC_DUAL
|
||||
&& param->solver_type != L2R_L1LOSS_SVC_DUAL)
|
||||
return "Recalculating w in the end is only for dual solvers for L2-regularized L1/L2-loss SVM";
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user