コード例 #1
0
    public static void Main()
    {
        modshogun.init_shogun_with_defaults();
        int cardinality = 2;
        int cache       = 10;

        double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat");
        double[,] testdata_real  = Load.load_numbers("../data/fm_test_real.dat");
        String[] fm_train_dna = Load.load_dna("../data/fm_train_dna.dat");
        String[] fm_test_dna  = Load.load_dna("../data/fm_test_dna.dat");

        RealFeatures subfeats_train = new RealFeatures(traindata_real);
        RealFeatures subfeats_test  = new RealFeatures(testdata_real);

        CombinedKernel   kernel      = new CombinedKernel();
        CombinedFeatures feats_train = new CombinedFeatures();
        CombinedFeatures feats_test  = new CombinedFeatures();

        GaussianKernel subkernel = new GaussianKernel(cache, 1.1);

        feats_train.append_feature_obj(subfeats_train);
        feats_test.append_feature_obj(subfeats_test);
        kernel.append_kernel(subkernel);

        StringCharFeatures subkfeats_train = new StringCharFeatures(fm_train_dna, EAlphabet.DNA);
        StringCharFeatures subkfeats_test  = new StringCharFeatures(fm_test_dna, EAlphabet.DNA);

        int degree = 3;

        FixedDegreeStringKernel subkernel2 = new FixedDegreeStringKernel(10, degree);

        feats_train.append_feature_obj(subkfeats_train);
        feats_test.append_feature_obj(subkfeats_test);
        kernel.append_kernel(subkernel2);

        subkfeats_train = new StringCharFeatures(fm_train_dna, EAlphabet.DNA);
        subkfeats_test  = new StringCharFeatures(fm_test_dna, EAlphabet.DNA);
        LocalAlignmentStringKernel subkernel3 = new LocalAlignmentStringKernel(10);

        feats_train.append_feature_obj(subkfeats_train);
        feats_test.append_feature_obj(subkfeats_test);
        kernel.append_kernel(subkernel3);

        kernel.init(feats_train, feats_train);
        double[,] km_train = kernel.get_kernel_matrix();

        kernel.init(feats_train, feats_test);
        double[,] km_test = kernel.get_kernel_matrix();

        modshogun.exit_shogun();
    }
コード例 #2
0
    public virtual object run(IList para)
    {
        modshogun.init_shogun_with_defaults();
        int cardinality = (int)((int?)para[0]);
        int size_cache = (int)((int?)para[1]);

        DoubleMatrix traindata_real = Load.load_numbers("../data/fm_train_real.dat");
        DoubleMatrix testdata_real = Load.load_numbers("../data/fm_test_real.dat");
        string[] fm_train_dna = Load.load_dna("../data/fm_train_dna.dat");
        string[] fm_test_dna = Load.load_dna("../data/fm_test_dna.dat");

        RealFeatures subfeats_train = new RealFeatures(traindata_real);
        RealFeatures subfeats_test = new RealFeatures(testdata_real);

        CombinedKernel kernel = new CombinedKernel();
        CombinedFeatures feats_train = new CombinedFeatures();
        CombinedFeatures feats_test = new CombinedFeatures();

        GaussianKernel subkernel = new GaussianKernel(10, 1.1);
        feats_train.append_feature_obj(subfeats_train);
        feats_test.append_feature_obj(subfeats_test);
        kernel.append_kernel(subkernel);

        StringCharFeatures subkfeats_train = new StringCharFeatures(fm_train_dna, DNA);
        StringCharFeatures subkfeats_test = new StringCharFeatures(fm_test_dna, DNA);
        int degree = 3;
        FixedDegreeStringKernel subkernel2 = new FixedDegreeStringKernel(10, degree);
        feats_train.append_feature_obj(subkfeats_train);
        feats_test.append_feature_obj(subkfeats_test);
        kernel.append_kernel(subkernel2);

        subkfeats_train = new StringCharFeatures(fm_train_dna, DNA);
        subkfeats_test = new StringCharFeatures(fm_test_dna, DNA);
        LocalAlignmentStringKernel subkernel3 = new LocalAlignmentStringKernel(10);
        feats_train.append_feature_obj(subkfeats_train);
        feats_test.append_feature_obj(subkfeats_test);
        kernel.append_kernel(subkernel3);

        kernel.init(feats_train, feats_train);
        DoubleMatrix km_train =kernel.get_kernel_matrix();
        kernel.init(feats_train, feats_test);
        DoubleMatrix km_test =kernel.get_kernel_matrix();

        ArrayList result = new ArrayList();
        result.Add(km_train);
        result.Add(km_test);
        result.Add(kernel);

        modshogun.exit_shogun();
        return (object)result;
    }
コード例 #3
0
    public static void Main()
    {
        modshogun.init_shogun_with_defaults();
        int cardinality = 2;
        int cache = 10;

        double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat");
        double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat");
        String[] fm_train_dna = Load.load_dna("../data/fm_train_dna.dat");
        String[] fm_test_dna = Load.load_dna("../data/fm_test_dna.dat");

        RealFeatures subfeats_train = new RealFeatures(traindata_real);
        RealFeatures subfeats_test = new RealFeatures(testdata_real);

        CombinedKernel kernel= new CombinedKernel();
        CombinedFeatures feats_train = new CombinedFeatures();
        CombinedFeatures feats_test = new CombinedFeatures();

        GaussianKernel subkernel = new GaussianKernel(cache, 1.1);
        feats_train.append_feature_obj(subfeats_train);
        feats_test.append_feature_obj(subfeats_test);
        kernel.append_kernel(subkernel);

        StringCharFeatures subkfeats_train = new StringCharFeatures(fm_train_dna, EAlphabet.DNA);
        StringCharFeatures subkfeats_test = new StringCharFeatures(fm_test_dna, EAlphabet.DNA);

        int degree = 3;

        FixedDegreeStringKernel subkernel2= new FixedDegreeStringKernel(10, degree);
        feats_train.append_feature_obj(subkfeats_train);
        feats_test.append_feature_obj(subkfeats_test);
        kernel.append_kernel(subkernel2);

        subkfeats_train = new StringCharFeatures(fm_train_dna, EAlphabet.DNA);
        subkfeats_test = new StringCharFeatures(fm_test_dna, EAlphabet.DNA);
        LocalAlignmentStringKernel subkernel3 = new LocalAlignmentStringKernel(10);
        feats_train.append_feature_obj(subkfeats_train);
        feats_test.append_feature_obj(subkfeats_test);
        kernel.append_kernel(subkernel3);

        kernel.init(feats_train, feats_train);
        double[,] km_train=kernel.get_kernel_matrix();

        kernel.init(feats_train, feats_test);
        double[,] km_test=kernel.get_kernel_matrix();

        modshogun.exit_shogun();
    }
コード例 #4
0
	public static void Main() {
		modshogun.init_shogun_with_defaults();
		int degree = 4;

		String[] fm_train_dna = Load.load_dna("../data/fm_train_dna.dat");
		String[] fm_test_dna = Load.load_dna("../data/fm_test_dna.dat");

		StringCharFeatures feats_train = new StringCharFeatures(fm_train_dna, EAlphabet.DNA);
		StringCharFeatures feats_test = new StringCharFeatures(fm_test_dna, EAlphabet.DNA);

		FixedDegreeStringKernel kernel = new FixedDegreeStringKernel(feats_train, feats_train, degree);

		double[,] km_train = kernel.get_kernel_matrix();
		kernel.init(feats_train, feats_test);
		double[,] km_test = kernel.get_kernel_matrix();
		modshogun.exit_shogun();
	}
コード例 #5
0
    public static void Main()
    {
        modshogun.init_shogun_with_defaults();
        int degree = 4;

        String[] fm_train_dna = Load.load_dna("../data/fm_train_dna.dat");
        String[] fm_test_dna  = Load.load_dna("../data/fm_test_dna.dat");

        StringCharFeatures feats_train = new StringCharFeatures(fm_train_dna, EAlphabet.DNA);
        StringCharFeatures feats_test  = new StringCharFeatures(fm_test_dna, EAlphabet.DNA);

        FixedDegreeStringKernel kernel = new FixedDegreeStringKernel(feats_train, feats_train, degree);

        double[,] km_train = kernel.get_kernel_matrix();
        kernel.init(feats_train, feats_test);
        double[,] km_test = kernel.get_kernel_matrix();
    }
コード例 #6
0
 internal static HandleRef getCPtr(FixedDegreeStringKernel obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #7
0
 internal static HandleRef getCPtr(FixedDegreeStringKernel obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }