static void Main(string[] args) { var kernel = new CustomKernel(); kernel.Load <TestModule>(); var testClasses = kernel.GetAll <ITestInterface>(); foreach (var c in testClasses) { Console.WriteLine(c.Data); } Console.Read(); }
static void Main(string[] argv) { modshogun.init_shogun_with_defaults(); int dim = 7; DoubleMatrix data = DoubleMatrix.rand(dim, dim); RealFeatures feats = new RealFeatures(data); DoubleMatrix data_T = data.transpose(); DoubleMatrix symdata = data.add(data_T); int cols = (1 + dim) * dim / 2; DoubleMatrix lowertriangle = DoubleMatrix.zeros(1, cols); int count = 0; for (int i = 0; i < dim; i ++) { for (int j = 0; j < dim; j++) { if (j <= i) { lowertriangle.put(0, count++, symdata.get(i,j)); } } } CustomKernel kernel = new CustomKernel(); kernel.set_triangle_kernel_matrix_from_triangle(lowertriangle); DoubleMatrix km_triangletriangle = kernel.get_kernel_matrix(); kernel.set_triangle_kernel_matrix_from_full(symdata); DoubleMatrix km_fulltriangle =kernel.get_kernel_matrix(); kernel.set_full_kernel_matrix_from_full(data); DoubleMatrix km_fullfull =kernel.get_kernel_matrix(); modshogun.exit_shogun(); }
internal static HandleRef getCPtr(CustomKernel obj) { return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr); }
private static AbstractKernel initializeOperatorSpec(Operator operatorData) { AbstractKernel kernel; switch (operatorData.operatorSpec) { case "UNIQ": if (operatorData.operatorSpecArgs.Count == 1) { int fieldN = Int32.Parse(operatorData.operatorSpecArgs[0]); kernel = new UniqKernel(fieldN); break; } throw new Exception("Given Operator Spec arguments are invalid"); case "DUP": if (operatorData.operatorSpecArgs.Count == 0) { kernel = new DupKernel(); break; } throw new Exception("Given Operator Spec arguments are invalid"); case "COUNT": if (operatorData.operatorSpecArgs.Count == 0) { kernel = new CountKernel(); break; } throw new Exception("Given operator spec arguments are invalid"); case "FILTER": if (operatorData.operatorSpecArgs.Count == 3) { int fieldN = Int32.Parse(operatorData.operatorSpecArgs[0]); char cond = char.Parse(operatorData.operatorSpecArgs[1]); string val = operatorData.operatorSpecArgs[2]; kernel = new FilterKernel(fieldN, cond, val); break; } throw new Exception("Given Operator Spec arguments are invalid"); case "CUSTOM": if (operatorData.operatorSpecArgs.Count == 3) { string dll = operatorData.operatorSpecArgs[0]; string cls = operatorData.operatorSpecArgs[1]; string method = operatorData.operatorSpecArgs[2]; kernel = new CustomKernel(dll, cls, method); break; } throw new Exception("Given Operator Spec arguments are invalid"); case "OUTPUT": if (operatorData.operatorSpecArgs.Count == 0) { kernel = new OutputKernel(); break; } throw new Exception("Given Operator Spec arguments are invalid"); default: throw new Exception("Given Operator Spec \"" + operatorData.operatorSpec + "\" is invalid"); } return(kernel); }