コード例 #1
0
 public StreamingWordFeatures(WordFeatures simple_features) : this(modshogunPINVOKE.new_StreamingWordFeatures__SWIG_3(WordFeatures.getCPtr(simple_features)), true)
 {
     if (modshogunPINVOKE.SWIGPendingException.Pending)
     {
         throw modshogunPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #2
0
ファイル: WordFeatures.cs プロジェクト: Anshul-Bansal/gsoc
 public WordFeatures(WordFeatures orig) : this(modshogunPINVOKE.new_WordFeatures__SWIG_2(WordFeatures.getCPtr(orig)), true)
 {
     if (modshogunPINVOKE.SWIGPendingException.Pending)
     {
         throw modshogunPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #3
0
 public StreamingWordFeatures(WordFeatures simple_features, SWIGTYPE_p_double lab) : this(modshogunPINVOKE.new_StreamingWordFeatures__SWIG_2(WordFeatures.getCPtr(simple_features), SWIGTYPE_p_double.getCPtr(lab)), true)
 {
     if (modshogunPINVOKE.SWIGPendingException.Pending)
     {
         throw modshogunPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #4
0
 public void set_motif_positions(WordFeatures positions_lhs, WordFeatures positions_rhs)
 {
     modshogunPINVOKE.RegulatoryModulesStringKernel_set_motif_positions(swigCPtr, WordFeatures.getCPtr(positions_lhs), WordFeatures.getCPtr(positions_rhs));
     if (modshogunPINVOKE.SWIGPendingException.Pending)
     {
         throw modshogunPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #5
0
    public bool obtain_from_simple(WordFeatures sf)
    {
        bool ret = modshogunPINVOKE.SparseWordFeatures_obtain_from_simple(swigCPtr, WordFeatures.getCPtr(sf));

        if (modshogunPINVOKE.SWIGPendingException.Pending)
        {
            throw modshogunPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
コード例 #6
0
ファイル: WordFeatures.cs プロジェクト: Anshul-Bansal/gsoc
    public WordFeatures get_transposed()
    {
        IntPtr       cPtr = modshogunPINVOKE.WordFeatures_get_transposed(swigCPtr);
        WordFeatures ret  = (cPtr == IntPtr.Zero) ? null : new WordFeatures(cPtr, true);

        if (modshogunPINVOKE.SWIGPendingException.Pending)
        {
            throw modshogunPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
コード例 #7
0
    public static void Main()
    {
        modshogun.init_shogun_with_defaults();
        double scale = 1.2;

        double[,] traindata_real = Load.load_numbers("../data/fm_train_word.dat");
        double[,] testdata_real  = Load.load_numbers("../data/fm_test_word.dat");

        short[,] traindata_word = new short[traindata_real.GetLength(0), traindata_real.GetLength(1)];
        for (int i = 0; i < traindata_real.GetLength(0); i++)
        {
            for (int j = 0; j < traindata_real.GetLength(1); j++)
            {
                traindata_word[i, j] = (short)traindata_real[i, j];
            }
        }

        short[,] testdata_word = new short[testdata_real.GetLength(0), testdata_real.GetLength(1)];
        for (int i = 0; i < testdata_real.GetLength(0); i++)
        {
            for (int j = 0; j < testdata_real.GetLength(1); j++)
            {
                testdata_word[i, j] = (short)testdata_real[i, j];
            }
        }
        WordFeatures feats_train = new WordFeatures(traindata_word);
        WordFeatures feats_test  = new WordFeatures(testdata_word);

        LinearKernel kernel = new LinearKernel(feats_train, feats_test);

        kernel.set_normalizer(new AvgDiagKernelNormalizer(scale));
        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();

        foreach (double item in km_train)
        {
            Console.Write(item);
        }

        foreach (double item in km_test)
        {
            Console.Write(item);
        }

        modshogun.exit_shogun();
    }
コード例 #8
0
    public static void Main()
    {
        modshogun.init_shogun_with_defaults();
        double scale = 1.2;

        double[,] traindata_real = Load.load_numbers("../data/fm_train_word.dat");
        double[,] testdata_real = Load.load_numbers("../data/fm_test_word.dat");

        short[,] traindata_word = new short[traindata_real.GetLength(0), traindata_real.GetLength(1)];
        for (int i = 0; i < traindata_real.GetLength(0); i++){
            for (int j = 0; j < traindata_real.GetLength(1); j++)
                traindata_word[i, j] = (short)traindata_real[i, j];
        }

        short[,] testdata_word = new short[testdata_real.GetLength(0), testdata_real.GetLength(1)];
        for (int i = 0; i < testdata_real.GetLength(0); i++){
            for (int j = 0; j < testdata_real.GetLength(1); j++)
                testdata_word[i, j] = (short)testdata_real[i, j];
        }
        WordFeatures feats_train = new WordFeatures(traindata_word);
        WordFeatures feats_test = new WordFeatures(testdata_word);

        LinearKernel kernel = new LinearKernel(feats_train, feats_test);
        kernel.set_normalizer(new AvgDiagKernelNormalizer(scale));
        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();

        foreach(double item in km_train) {
            Console.Write(item);
        }

        foreach(double item in km_test) {
            Console.Write(item);
        }

        modshogun.exit_shogun();
    }
コード例 #9
0
    static void Main(string[] argv)
    {
        modshogun.init_shogun_with_defaults();
        double scale = 1.2;

        DoubleMatrix traindata_real = Load.load_numbers("../data/fm_train_word.dat");
        DoubleMatrix testdata_real = Load.load_numbers("../data/fm_test_word.dat");

        WordFeatures feats_train = new WordFeatures(traindata_real);
        WordFeatures feats_test = new WordFeatures(testdata_real);

        LinearKernel kernel = new LinearKernel(feats_train, feats_test);
        kernel.set_normalizer(new AvgDiagKernelNormalizer(scale));
        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();

        Console.WriteLine(km_train.ToString());
        Console.WriteLine(km_test.ToString());

        modshogun.exit_shogun();
    }
コード例 #10
0
 public void set_motif_positions(WordFeatures positions_lhs, WordFeatures positions_rhs) {
   modshogunPINVOKE.RegulatoryModulesStringKernel_set_motif_positions(swigCPtr, WordFeatures.getCPtr(positions_lhs), WordFeatures.getCPtr(positions_rhs));
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #11
0
ファイル: WordFeatures.cs プロジェクト: Anshul-Bansal/gsoc
 public WordFeatures(WordFeatures orig) : this(modshogunPINVOKE.new_WordFeatures__SWIG_2(WordFeatures.getCPtr(orig)), true) {
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #12
0
ファイル: WordFeatures.cs プロジェクト: Anshul-Bansal/gsoc
 internal static HandleRef getCPtr(WordFeatures obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
コード例 #13
0
 public StreamingWordFeatures(WordFeatures simple_features, SWIGTYPE_p_double lab) : this(modshogunPINVOKE.new_StreamingWordFeatures__SWIG_2(WordFeatures.getCPtr(simple_features), SWIGTYPE_p_double.getCPtr(lab)), true) {
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #14
0
 public StreamingWordFeatures(WordFeatures simple_features) : this(modshogunPINVOKE.new_StreamingWordFeatures__SWIG_3(WordFeatures.getCPtr(simple_features)), true) {
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #15
0
ファイル: WordFeatures.cs プロジェクト: Anshul-Bansal/gsoc
 internal static HandleRef getCPtr(WordFeatures obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #16
0
 public RegulatoryModulesStringKernel(StringCharFeatures lstr, StringCharFeatures rstr, WordFeatures lpos, WordFeatures rpos, double width, int degree, int shift, int window) : this(modshogunPINVOKE.new_RegulatoryModulesStringKernel__SWIG_3(StringCharFeatures.getCPtr(lstr), StringCharFeatures.getCPtr(rstr), WordFeatures.getCPtr(lpos), WordFeatures.getCPtr(rpos), width, degree, shift, window), true)
 {
     if (modshogunPINVOKE.SWIGPendingException.Pending)
     {
         throw modshogunPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #17
0
 public RegulatoryModulesStringKernel(StringCharFeatures lstr, StringCharFeatures rstr, WordFeatures lpos, WordFeatures rpos, double width, int degree, int shift, int window) : this(modshogunPINVOKE.new_RegulatoryModulesStringKernel__SWIG_3(StringCharFeatures.getCPtr(lstr), StringCharFeatures.getCPtr(rstr), WordFeatures.getCPtr(lpos), WordFeatures.getCPtr(rpos), width, degree, shift, window), true) {
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }