예제 #1
0
    static void Main(string[] argv)
    {
        modshogun.init_shogun_with_defaults();

        List<DoubleMatrix> result = new List<DoubleMatrix>(4);

        DoubleMatrix inputRealMatrix = Load.load_numbers("../data/fm_train_real.dat");
        RealFeatures realFeatures = new RealFeatures(inputRealMatrix);
        DoubleMatrix outputRealMatrix = realFeatures.get_feature_matrix();

        result.Add(inputRealMatrix);
        result.Add(outputRealMatrix);

        DoubleMatrix inputByteMatrix = Load.load_numbers("../data/fm_train_byte.dat");
        ByteFeatures byteFeatures = new ByteFeatures(inputByteMatrix);
        DoubleMatrix outputByteMatrix = byteFeatures.get_feature_matrix();

        result.Add(inputByteMatrix);
        result.Add(outputByteMatrix);

        DoubleMatrix inputLongMatrix = Load.load_numbers("../data/fm_train_byte.dat");
        LongFeatures byteFeatures = new LongFeatures(inputLongMatrix);
        DoubleMatrix outputLongMatrix = longFeatures.get_feature_matrix();

        result.Add(inputByteMatrix);
        result.Add(outputByteMatrix);

        Console.WriteLine(result);

        modshogun.exit_shogun();
    }
예제 #2
0
 public ByteFeatures(ByteFeatures orig) : this(modshogunPINVOKE.new_ByteFeatures__SWIG_2(ByteFeatures.getCPtr(orig)), true)
 {
     if (modshogunPINVOKE.SWIGPendingException.Pending)
     {
         throw modshogunPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #3
0
 public StreamingByteFeatures(ByteFeatures simple_features) : this(modshogunPINVOKE.new_StreamingByteFeatures__SWIG_3(ByteFeatures.getCPtr(simple_features)), true)
 {
     if (modshogunPINVOKE.SWIGPendingException.Pending)
     {
         throw modshogunPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #4
0
 public StreamingByteFeatures(ByteFeatures simple_features, SWIGTYPE_p_double lab) : this(modshogunPINVOKE.new_StreamingByteFeatures__SWIG_2(ByteFeatures.getCPtr(simple_features), SWIGTYPE_p_double.getCPtr(lab)), true)
 {
     if (modshogunPINVOKE.SWIGPendingException.Pending)
     {
         throw modshogunPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #5
0
    public bool obtain_from_simple(ByteFeatures sf)
    {
        bool ret = modshogunPINVOKE.SparseByteFeatures_obtain_from_simple(swigCPtr, ByteFeatures.getCPtr(sf));

        if (modshogunPINVOKE.SWIGPendingException.Pending)
        {
            throw modshogunPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
예제 #6
0
    public ByteFeatures get_transposed()
    {
        IntPtr       cPtr = modshogunPINVOKE.ByteFeatures_get_transposed(swigCPtr);
        ByteFeatures ret  = (cPtr == IntPtr.Zero) ? null : new ByteFeatures(cPtr, true);

        if (modshogunPINVOKE.SWIGPendingException.Pending)
        {
            throw modshogunPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
예제 #7
0
    static void Main(string[] argv)
    {
        modshogun.init_shogun_with_defaults();
        double scale = 1.2;

        DoubleMatrix traindata_real = Load.load_numbers("../data/fm_train_byte.dat");
        DoubleMatrix testdata_real = Load.load_numbers("../data/fm_test_byte.dat");

        ByteFeatures feats_train = new ByteFeatures(traindata_real);
        ByteFeatures feats_test = new ByteFeatures(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();
    }
예제 #8
0
 public StreamingByteFeatures(ByteFeatures simple_features) : this(modshogunPINVOKE.new_StreamingByteFeatures__SWIG_3(ByteFeatures.getCPtr(simple_features)), true) {
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #9
0
 public StreamingByteFeatures(ByteFeatures simple_features, SWIGTYPE_p_double lab) : this(modshogunPINVOKE.new_StreamingByteFeatures__SWIG_2(ByteFeatures.getCPtr(simple_features), SWIGTYPE_p_double.getCPtr(lab)), true) {
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #10
0
 public ByteFeatures(ByteFeatures orig) : this(modshogunPINVOKE.new_ByteFeatures__SWIG_2(ByteFeatures.getCPtr(orig)), true) {
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #11
0
 internal static HandleRef getCPtr(ByteFeatures obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
예제 #12
0
 public bool obtain_from_simple(ByteFeatures sf) {
   bool ret = modshogunPINVOKE.SparseByteFeatures_obtain_from_simple(swigCPtr, ByteFeatures.getCPtr(sf));
   if (modshogunPINVOKE.SWIGPendingException.Pending) throw modshogunPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
예제 #13
0
 internal static HandleRef getCPtr(ByteFeatures obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }