public SparseMatrixPermFacade(SparseMatrix matrix, int[] rowMappings) { this.rowCount = rowMappings.Length; this.rowMappings = rowMappings; readOnlyMatrix = matrix; _logger = ApplicationLogging.CreateLogger <SparseMatrixPermFacade>(); }
public Tron(IFunction fun_obj, double eps = 0.1, double eps_cg = 0.1, int max_iter = 1000) { this.fun_obj = (fun_obj); this.eps = eps; this.eps_cg = eps_cg; this.max_iter = max_iter; _logger = ApplicationLogging.CreateLogger <Tron>(); }
public l2r_l2_svc_fun(Problem prob, double[] C) { this.prob = prob; this.z = new double[prob.l]; this.I = new int[prob.l]; this.C = C; _logger = ApplicationLogging.CreateLogger <l2r_l2_svc_fun>(); }
public SparseRowMatrixList(int rowCount, int colCount) { ContractAssertions.Requires <ArgumentOutOfRangeException> (rowCount >= 0, "RowCount must be positive"); ContractAssertions.Requires <ArgumentOutOfRangeException> (colCount >= 0, "colCount must be positive"); this.rowCount = rowCount; this.colCount = colCount; _logger = ApplicationLogging.CreateLogger <SparseRowMatrixList> (); }
public l2r_lr_fun(Problem prob, double[] C) { int l = prob.l; this.prob = prob; z = new double[l]; D = new double[l]; this.C = C; _logger = ApplicationLogging.CreateLogger <l2r_lr_fun>(); }
public SparseRowMatrixVN(int rowCount, int colCount) { ContractAssertions.Requires <ArgumentOutOfRangeException>(rowCount >= 0, "RowCount must be positive"); ContractAssertions.Requires <ArgumentOutOfRangeException>(rowCount >= 0, "colCount must be positive"); this.rowCount = rowCount; rowPtr = new int[rowCount + 1]; this.colCount = colCount; val = new SparseRowValue[0]; _logger = ApplicationLogging.CreateLogger <SparseRowMatrixVN>(); }
public Solver_MCSVM_CS(Problem prob, int nr_class, double[] weighted_C, double eps = 0.1, int max_iter = 100000) { this.w_size = prob.n; this.l = prob.l; this.nr_class = nr_class; this.eps = eps; this.max_iter = max_iter; this.prob = prob; this.B = new double[nr_class]; this.G = new double[nr_class]; this.C = weighted_C; this._logger = ApplicationLogging.CreateLogger <Solver_MCSVM_CS>(); }
public l2r_l1l2_svr() { _logger = ApplicationLogging.CreateLogger <l2r_l1l2_svr>(); }
public l2r_lr_dual() { _logger = ApplicationLogging.CreateLogger <l2r_lr_dual>(); }
public Linear() { this._logger = ApplicationLogging.CreateLogger <Linear>(); }
public static Model load_model(StreamReader fp) { Model model_ = null; string whitespace = "\\s+"; try { model_ = new Model(); //model_ Parameter p = new Parameter(); p.nr_weight = 0; p.weight_label = null; p.weight = null; p.init_sol = null; model_.param = p; model_.label = null; string line = fp.ReadLine(); while (line != null) { string[] tokens = Regex.Split(line, whitespace); if (tokens[0].CompareTo("solver_type") == 0) { if (!Enum.TryParse(tokens[1], out p.solver_type)) { throw new IOException("unknown solver type"); } } else if (line.CompareTo("nr_class") == 0) { line = fp.ReadLine(); model_.nr_class = int.Parse(line); } else if (tokens[0].CompareTo("nr_feature") == 0) { model_.nr_feature = int.Parse(tokens[1]); } else if (tokens[0].CompareTo("bias") == 0) { model_.bias = double.Parse(tokens[1]); } else if (tokens[0].CompareTo("w") == 0) { break; } else if (tokens[0].CompareTo("label") == 0) { int nr_class = model_.nr_class; model_.label = new int[nr_class]; string[] s = line.Split(" "); for (int i = 0; i < nr_class; i++) { model_.label[i] = int.Parse(tokens[i + 1]); } } else { throw new IOException(String.Format("unknown text in model file: [{0}]\n", line)); } // Load in W int w_size = model_.nr_feature; if (model_.bias >= 0) { w_size++; } int nr_w = model_.nr_class; if (model_.nr_class == 2 && model_.param.solver_type != SOLVER_TYPE.MCSVM_CS) { nr_w = 1; } model_.w = new double[w_size * nr_w]; char[] buffer = new char[256]; for (int i = 0; i < w_size; i++) { for (int j = 0; j < nr_w; j++) { int b = 0; while (true) { char ch = (char)fp.Read(); if (ch == -1) { throw new EndOfStreamException("unexpected EOF"); } if (ch == ' ') { model_.w[i * nr_w + j] = Double.Parse(new String(buffer, 0, b)); break; } else { if (b >= buffer.Length) { throw new ApplicationException("illegal weight in model file at index " + (i * nr_w + j) + ", with string content '" + new String(buffer, 0, buffer.Length) + "', is not terminated " + "with a whitespace character, or is longer than expected (" + buffer.Length + " characters max)."); } buffer[b++] = ch; } } } } } } catch (IOException e) { ApplicationLogging.CreateLogger <Model>().LogError(e.Message); // Console.WriteLine (e.Message); return(null); } return(model_); }
public Model() { this._logger = ApplicationLogging.CreateLogger <Model> (); }
public l2r_l2_svr_fun(Problem prob, double[] C, double p) : base(prob, C) { this.p = p; _logger = ApplicationLogging.CreateLogger <l2r_l2_svr_fun>(); }
public l1r_l2_svc() { _logger = ApplicationLogging.CreateLogger <l1r_l2_svc>(); }
public l1r_lr() { _logger = ApplicationLogging.CreateLogger <l1r_lr>(); }