void Solve(int l, QMatrix Q, double[] p, byte[] y, double[] alpha, double Cp, double Cn, double eps, SolutionInfo si, int shrinking) { this.si = si; super.Solve(l,Q,p,y,alpha,Cp,Cn,eps,si,shrinking); }
if(!is_upper_bound(i)) if(!is_lower_bound(i)) if(!is_upper_bound(i)) if(!is_lower_bound(i)) reconstruct_gradient(); active_size = l; if (be_shrunk(i, Gmax1, Gmax2)) if (!be_shrunk(active_size, Gmax1, Gmax2)) swap_index(i,active_size); break;
void update_alpha_status(int i) { if(alpha[i] >= get_C(i)) alpha_status[i] = UPPER_BOUND; else if(alpha[i] <= 0) alpha_status[i] = LOWER_BOUND; else alpha_status[i] = FREE; } boolean is_upper_bound(int i) { return alpha_status[i] == UPPER_BOUND; }
private boolean be_shrunk(int i, double Gmax1, double Gmax2) { if(is_upper_bound(i)) { if(y[i]==+1) return(-G[i] > Gmax1); else return(-G[i] > Gmax2); } else if(is_lower_bound(i)) { if(y[i]==+1) return(G[i] > Gmax2); else return(G[i] > Gmax1); } else return(false); }
update_alpha_status(i); if(!is_lower_bound(i)) for(j=0;j<l;j++) G[j] += alpha_i*Q_i[j]; if(is_upper_bound(i)) for(j=0;j<l;j++) G_bar[j] += get_C(i) * Q_i[j]; if(shrinking!=0) do_shrinking(); svm.info("."); if(select_working_set(working_set)!=0) reconstruct_gradient(); if(select_working_set(working_set)!=0) break; else double C_i = get_C(i); double C_j = get_C(j); boolean ui = is_upper_bound(i); boolean uj = is_upper_bound(j); update_alpha_status(i); update_alpha_status(j); int k;
private static void solve_one_class(svm_problem prob, svm_parameter param, double[] alpha, Solver.SolutionInfo si) { int l = prob.l; double[] zeros = new double[l]; byte[] ones = new byte[l]; int i; int n = (int)(param.nu*prob.l); // # of alpha's at upper bound for(i=0;i<n;i++) alpha[i] = 1; if(n<prob.l) alpha[n] = param.nu * prob.l - n; for(i=n+1;i<l;i++) alpha[i] = 0; for(i=0;i<l;i++) { zeros[i] = 0; ones[i] = 1; } Solver s = new Solver(); s.Solve(l, new ONE_CLASS_Q(prob,param), zeros, ones, alpha, 1.0, 1.0, param.eps, si, param.shrinking); }
update_alpha_status(i); if(!is_lower_bound(i)) for(j=0;j<l;j++) G[j] += alpha_i*Q_i[j]; if(is_upper_bound(i)) for(j=0;j<l;j++) G_bar[j] += get_C(i) * Q_i[j]; if(shrinking!=0) do_shrinking(); svm.info("."); if(select_working_set(working_set)!=0) reconstruct_gradient(); if(select_working_set(working_set)!=0) break; else double C_i = get_C(i); double C_j = get_C(j); boolean ui = is_upper_bound(i); boolean uj = is_upper_bound(j); update_alpha_status(i); update_alpha_status(j); int k;
private boolean be_shrunk(int i, double Gmax1, double Gmax2) { if(is_upper_bound(i)) { if(y[i]==+1) return(-G[i] > Gmax1); else return(-G[i] > Gmax2); } else if(is_lower_bound(i)) { if(y[i]==+1) return(G[i] > Gmax2); else return(G[i] > Gmax1); } else return(false); }
private static void solve_one_class(svm_problem prob, svm_parameter param, double[] alpha, Solver.SolutionInfo si) { int l = prob.l; double[] zeros = new double[l]; byte[] ones = new byte[l]; int i; int n = (int)(param.nu*prob.l); // # of alpha's at upper bound for(i=0;i<n;i++) alpha[i] = 1; if(n<prob.l) alpha[n] = param.nu * prob.l - n; for(i=n+1;i<l;i++) alpha[i] = 0; for(i=0;i<l;i++) { zeros[i] = 0; ones[i] = 1; } Solver s = new Solver(); s.Solve(l, new ONE_CLASS_Q(prob,param), zeros, ones, alpha, 1.0, 1.0, param.eps, si, param.shrinking); }
update_alpha_status(i); if(!is_lower_bound(i)) for(j=0;j<l;j++) G[j] += alpha_i*Q_i[j]; if(is_upper_bound(i)) for(j=0;j<l;j++) G_bar[j] += get_C(i) * Q_i[j]; if(shrinking!=0) do_shrinking(); svm.info("."); if(select_working_set(working_set)!=0) reconstruct_gradient(); if(select_working_set(working_set)!=0) break; else double C_i = get_C(i); double C_j = get_C(j); boolean ui = is_upper_bound(i); boolean uj = is_upper_bound(j); update_alpha_status(i); update_alpha_status(j); int k;
if(!is_upper_bound(i)) if(!is_lower_bound(i)) if(!is_upper_bound(i)) if(!is_lower_bound(i)) reconstruct_gradient(); active_size = l; if (be_shrunk(i, Gmax1, Gmax2)) if (!be_shrunk(active_size, Gmax1, Gmax2)) swap_index(i,active_size); break;
private boolean be_shrunk(int i, double Gmax1, double Gmax2) { if(is_upper_bound(i)) { if(y[i]==+1) return(-G[i] > Gmax1); else return(-G[i] > Gmax2); } else if(is_lower_bound(i)) { if(y[i]==+1) return(G[i] > Gmax2); else return(G[i] > Gmax1); } else return(false); }
private static void solve_one_class(svm_problem prob, svm_parameter param, double[] alpha, Solver.SolutionInfo si) { int l = prob.l; double[] zeros = new double[l]; byte[] ones = new byte[l]; int i; int n = (int)(param.nu*prob.l); // # of alpha's at upper bound for(i=0;i<n;i++) alpha[i] = 1; if(n<prob.l) alpha[n] = param.nu * prob.l - n; for(i=n+1;i<l;i++) alpha[i] = 0; for(i=0;i<l;i++) { zeros[i] = 0; ones[i] = 1; } Solver s = new Solver(); s.Solve(l, new ONE_CLASS_Q(prob,param), zeros, ones, alpha, 1.0, 1.0, param.eps, si, param.shrinking); }
void Solve(int l, QMatrix Q, double[] p, byte[] y, double[] alpha, double Cp, double Cn, double eps, SolutionInfo si, int shrinking) { this.si = si; super.Solve(l,Q,p,y,alpha,Cp,Cn,eps,si,shrinking); }
void update_alpha_status(int i) { if(alpha[i] >= get_C(i)) alpha_status[i] = UPPER_BOUND; else if(alpha[i] <= 0) alpha_status[i] = LOWER_BOUND; else alpha_status[i] = FREE; } boolean is_upper_bound(int i) { return alpha_status[i] == UPPER_BOUND; }
if(!is_upper_bound(i)) if(!is_lower_bound(i)) if(!is_upper_bound(i)) if(!is_lower_bound(i)) reconstruct_gradient(); active_size = l; if (be_shrunk(i, Gmax1, Gmax2)) if (!be_shrunk(active_size, Gmax1, Gmax2)) swap_index(i,active_size); break;
if(is_lower_bound(i)) lb = Math.max(lb,yG); else if(is_upper_bound(i))