当前位置: 首页>>代码示例>>C#>>正文


C# RealFeatures.set_feature_matrix方法代码示例

本文整理汇总了C#中RealFeatures.set_feature_matrix方法的典型用法代码示例。如果您正苦于以下问题:C# RealFeatures.set_feature_matrix方法的具体用法?C# RealFeatures.set_feature_matrix怎么用?C# RealFeatures.set_feature_matrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RealFeatures的用法示例。


在下文中一共展示了RealFeatures.set_feature_matrix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

    static void Main(string[] argv)
    {
        modshogun.init_shogun_with_defaults();
        double C = 0.9;
        double epsilon = 1e-3;

        org.shogun.Math.init_random(17);
        DoubleMatrix traindata_real = Load.load_numbers(".../data/fm_train_real.dat");
        DoubleMatrix testdata_real = Load.load_numbers("../data/toy/fm_test_real.dat");

        DoubleMatrix trainlab = Load.load_labels("../data/label_train_twoclass.dat");

        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);

        Labels labels = new Labels(trainlab);

        LibLinear svm = new LibLinear(C, feats_train, labels);
        svm.set_liblinear_solver_type(L2R_L2LOSS_SVC_DUAL);
        svm.set_epsilon(epsilon);
        svm.set_bias_enabled(true);
        svm.train();
        svm.set_features(feats_test);
        DoubleMatrix out_labels = svm.apply().get_labels();
        Console.WriteLine(out_labels.ToString());

        modshogun.exit_shogun();
    }
开发者ID:orico,项目名称:shogun,代码行数:30,代码来源:classifier_liblinear_modular.cs

示例2: Main

    public static void Main()
    {
        modshogun.init_shogun_with_defaults();
        double learn_rate = 1.0;
        int max_iter = 1000;

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

        // already tried double[][]
        double[] trainlab = Load.load_labels("../data/label_train_twoclass.dat");

        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);

        Labels labels = new Labels(trainlab);

        Perceptron perceptron = new Perceptron(feats_train, labels);
        perceptron.set_learn_rate(learn_rate);
        perceptron.set_max_iter(max_iter);
        perceptron.train();

        perceptron.set_features(feats_test);
        //  already tried double[][]
        double[] out_labels = perceptron.apply().get_labels();

        foreach (double item in out_labels)
            Console.Write(item);

        modshogun.exit_shogun();
    }
开发者ID:joseph-chan,项目名称:rqpersonalsvn,代码行数:33,代码来源:classifier_perceptron_modular.cs

示例3: run

    public virtual Serializable run(IList para)
    {
        modshogun.init_shogun_with_defaults();
        double learn_rate = (double)((double?)para[0]);
        int max_iter = (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");

        DoubleMatrix trainlab = Load.load_labels("../data/label_train_twoclass.dat");
        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);
        Labels labels = new Labels(trainlab);
        AveragedPerceptron perceptron = new AveragedPerceptron(feats_train, labels);
        perceptron.set_learn_rate(learn_rate);
        perceptron.set_max_iter(max_iter);
        perceptron.train();

        perceptron.set_features(feats_test);
        DoubleMatrix out_labels = perceptron.apply().get_labels();
        ArrayList result = new ArrayList();
        result.Add(perceptron);
        result.Add(out_labels);

        modshogun.exit_shogun();
        return result;
    }
开发者ID:orico,项目名称:shogun,代码行数:29,代码来源:classifier_averaged_perceptron_modular.cs

示例4: Main

	public static void Main() {
		modshogun.init_shogun_with_defaults();
		double width = 2.1;
		double epsilon = 1e-5;
		double C = 1.0;

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

		//  already tried double[,]
		double[] trainlab = Load.load_labels("../data/label_train_twoclass.dat");

		RealFeatures feats_train = new RealFeatures();
		feats_train.set_feature_matrix(traindata_real);
		RealFeatures feats_test = new RealFeatures();
		feats_test.set_feature_matrix(testdata_real);

		GaussianKernel kernel = new GaussianKernel(feats_train, feats_train, width);

		BinaryLabels labels = new BinaryLabels(trainlab);

		MPDSVM svm = new MPDSVM(C, kernel, labels);
		svm.set_epsilon(epsilon);
		svm.train();

		kernel.init(feats_train, feats_test);
		//  already tried double[,]
		double[] out_labels = LabelsFactory.to_binary(svm.apply()).get_labels();

		foreach (double item in out_labels)
		      Console.Write(item);

	}
开发者ID:JackieXie168,项目名称:shogun,代码行数:33,代码来源:classifier_mpdsvm_modular.cs

示例5: Main

    static void Main(string[] argv)
    {
        modshogun.init_shogun_with_defaults();
        double width = 2.1;
        double epsilon = 1e-5;
        double C = 1.0;

        DoubleMatrix traindata_real = Load.load_numbers("../data/fm_train_real.dat");
        DoubleMatrix testdata_real = Load.load_numbers("../data/fm_test_real.dat");

        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);

        GaussianKernel kernel = new GaussianKernel(feats_train, feats_train, width);

        LibSVMOneClass svm = new LibSVMOneClass(C, kernel);
        svm.set_epsilon(epsilon);
        svm.train();

        kernel.init(feats_train, feats_test);
        DoubleMatrix out_labels = svm.apply().get_labels();
        Console.WriteLine(out_labels.ToString());

        modshogun.exit_shogun();
    }
开发者ID:orico,项目名称:shogun,代码行数:27,代码来源:classifier_libsvmoneclass_modular.cs

示例6: Main

	public static void Main() {
		modshogun.init_shogun_with_defaults();
		double width = 2.1;
		double epsilon = 1e-5;
		double C = 1.0;

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

		double[] trainlab = Load.load_labels("../data/label_train_multiclass.dat");

		RealFeatures feats_train = new RealFeatures();
		feats_train.set_feature_matrix(traindata_real);
		RealFeatures feats_test = new RealFeatures();
		feats_test.set_feature_matrix(testdata_real);

		GaussianKernel kernel = new GaussianKernel(feats_train, feats_train, width);

		MulticlassLabels labels = new MulticlassLabels(trainlab);

		LaRank svm = new LaRank(C, kernel, labels);
		svm.set_batch_mode(false);
		svm.set_epsilon(epsilon);
		svm.train();
		double[] out_labels = LabelsFactory.to_multiclass(svm.apply(feats_train)).get_labels();

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

	}
开发者ID:JackieXie168,项目名称:shogun,代码行数:31,代码来源:classifier_larank_modular.cs

示例7: Main

    static void Main(string[] argv)
    {
        modshogun.init_shogun_with_defaults();
        double learn_rate = 1.0;
        int max_iter = 1000;

        DoubleMatrix traindata_real = Load.load_numbers("../data/fm_train_real.dat");
        DoubleMatrix testdata_real = Load.load_numbers("../data/fm_test_real.dat");

        DoubleMatrix trainlab = Load.load_labels("../data/label_train_twoclass.dat");

        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);

        Labels labels = new Labels(trainlab);

        Perceptron perceptron = new Perceptron(feats_train, labels);
        perceptron.set_learn_rate(learn_rate);
        perceptron.set_max_iter(max_iter);
        perceptron.train();

        perceptron.set_features(feats_test);
        DoubleMatrix out_labels = perceptron.apply().get_labels();
        Console.WriteLine(out_labels.ToString());

        modshogun.exit_shogun();
    }
开发者ID:orico,项目名称:shogun,代码行数:29,代码来源:classifier_perceptron_modular.cs

示例8: Main

    public static void Main()
    {
        modshogun.init_shogun_with_defaults();
        double width = 2.1;
        double epsilon = 1e-5;
        double C = 1.0;

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

        double[] trainlab = Load.load_labels("../data/label_train_multiclass.dat");

        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);

        GaussianKernel kernel = new GaussianKernel(feats_train, feats_train, width);

        MulticlassLabels labels = new MulticlassLabels(trainlab);

        MulticlassLibSVM svm = new MulticlassLibSVM(C, kernel, labels);
        svm.set_epsilon(epsilon);
        svm.train();

        kernel.init(feats_train, feats_test);
        double[] out_labels = MulticlassLabels.obtain_from_generic(svm.apply()).get_labels();

        foreach (double item in out_labels)
            Console.Write(item);

        modshogun.exit_shogun();
    }
开发者ID:joseph-chan,项目名称:rqpersonalsvn,代码行数:33,代码来源:classifier_multiclasslibsvm_modular.cs

示例9: Main

    public static void Main()
    {
        modshogun.init_shogun_with_defaults();
        double C = 0.9;
        double epsilon = 1e-3;

        Math.init_random(17);
        double[,] traindata_real = Load.load_numbers("../data/fm_train_real.dat");
        double[,] testdata_real = Load.load_numbers("../data/fm_test_real.dat");

        double[] trainlab = Load.load_labels("../data/label_train_twoclass.dat");

        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);

        BinaryLabels labels = new BinaryLabels(trainlab);

        LibLinear svm = new LibLinear(C, feats_train, labels);
        svm.set_liblinear_solver_type(LIBLINEAR_SOLVER_TYPE.L2R_L2LOSS_SVC_DUAL);
        svm.set_epsilon(epsilon);
        svm.set_bias_enabled(true);
        svm.train();
        svm.set_features(feats_test);
        double[] out_labels = BinaryLabels.obtain_from_generic(svm.apply()).get_labels();

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

        modshogun.exit_shogun();
    }
开发者ID:behollis,项目名称:muViewBranch,代码行数:33,代码来源:classifier_liblinear_modular.cs

示例10: Main

	public static void Main() {
		modshogun.init_shogun_with_defaults();
		int gamma = 3;

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

		double[] trainlab = Load.load_labels("../data/label_train_twoclass.dat");

		RealFeatures feats_train = new RealFeatures();
		feats_train.set_feature_matrix(traindata_real);
		RealFeatures feats_test = new RealFeatures();
		feats_test.set_feature_matrix(testdata_real);

		BinaryLabels labels = new BinaryLabels(trainlab);

		LDA lda = new LDA(gamma, feats_train, labels);
		lda.train();

		Console.WriteLine(lda.get_bias());

		//Console.WriteLine(lda.get_w().toString());
		foreach(double item in lda.get_w()) {
			Console.Write(item);
		}


		lda.set_features(feats_test);
		double[] out_labels = LabelsFactory.to_binary(lda.apply()).get_labels();

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

	}
开发者ID:JackieXie168,项目名称:shogun,代码行数:35,代码来源:classifier_lda_modular.cs

示例11: Main

    static void Main(string[] argv)
    {
        modshogun.init_shogun_with_defaults();
        double width = 2.1;
        double epsilon = 1e-5;
        double C = 1.0;

        DoubleMatrix traindata_real = Load.load_numbers("../data/fm_train_real.dat");
        DoubleMatrix testdata_real = Load.load_numbers("../data/fm_test_real.dat");

        DoubleMatrix trainlab = Load.load_labels("../data/label_train_multiclass.dat");

        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);

        GaussianKernel kernel = new GaussianKernel(feats_train, feats_train, width);

        Labels labels = new Labels(trainlab);

        LaRank svm = new LaRank(C, kernel, labels);
        svm.set_batch_mode(false);
        svm.set_epsilon(epsilon);
        svm.train();
        DoubleMatrix out_labels = svm.apply(feats_train).get_labels();
        Console.WriteLine(out_labels.ToString());

        modshogun.exit_shogun();
    }
开发者ID:orico,项目名称:shogun,代码行数:30,代码来源:classifier_larank_modular.cs

示例12: Main

	public static void Main() {
		modshogun.init_shogun_with_defaults();
		double width = 2.1;
		double epsilon = 1e-5;
		double C = 1.0;

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

		RealFeatures feats_train = new RealFeatures();
		feats_train.set_feature_matrix(traindata_real);
		RealFeatures feats_test = new RealFeatures();
		feats_test.set_feature_matrix(testdata_real);

		GaussianKernel kernel = new GaussianKernel(feats_train, feats_train, width);

		LibSVMOneClass svm = new LibSVMOneClass(C, kernel);
		svm.set_epsilon(epsilon);
		svm.train();

		kernel.init(feats_train, feats_test);
		double[] out_labels = svm.apply().get_labels();

		foreach (double item in out_labels)
		    Console.Write(item);

		modshogun.exit_shogun();
	}
开发者ID:Anshul-Bansal,项目名称:gsoc,代码行数:28,代码来源:classifier_libsvmoneclass_modular.cs

示例13: Main

    public static void Main()
    {
        modshogun.init_shogun_with_defaults();
        double learn_rate = 1.0;
        int max_iter = 1000;

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

        double[] trainlab = Load.load_labels("../data/label_train_twoclass.dat");
        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);
        BinaryLabels labels = new BinaryLabels(trainlab);
        AveragedPerceptron perceptron = new AveragedPerceptron(feats_train, labels);
        perceptron.set_learn_rate(learn_rate);
        perceptron.set_max_iter(max_iter);
        perceptron.train();

        perceptron.set_features(feats_test);
        double[] out_labels = BinaryLabels.obtain_from_generic(perceptron.apply()).get_labels();

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

        modshogun.exit_shogun();
    }
开发者ID:behollis,项目名称:muViewBranch,代码行数:29,代码来源:classifier_averaged_perceptron_modular.cs

示例14: Main

    static void Main(string[] argv)
    {
        modshogun.init_shogun_with_defaults();
        int gamma = 3;

        DoubleMatrix traindata_real = Load.load_numbers("../data/fm_train_real.dat");
        DoubleMatrix testdata_real = Load.load_numbers("../data/fm_test_real.dat");

        DoubleMatrix trainlab = Load.load_labels("../data/label_train_twoclass.dat");

        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);

        Labels labels = new Labels(trainlab);

        LDA lda = new LDA(gamma, feats_train, labels);
        lda.train();

        Console.WriteLine(lda.get_bias());
        Console.WriteLine(lda.get_w().ToString());
        lda.set_features(feats_test);
        DoubleMatrix out_labels = lda.apply().get_labels();
        Console.WriteLine(out_labels.ToString());

        modshogun.exit_shogun();
    }
开发者ID:orico,项目名称:shogun,代码行数:28,代码来源:classifier_lda_modular.cs

示例15: Main

    public static void Main()
    {
        modshogun.init_shogun_with_defaults();

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

        double[] trainlab = Load.load_labels("../data/label_train_multiclass.dat");

        RealFeatures feats_train = new RealFeatures();
        feats_train.set_feature_matrix(traindata_real);
        RealFeatures feats_test = new RealFeatures();
        feats_test.set_feature_matrix(testdata_real);
        Labels labels = new Labels(trainlab);

        GaussianNaiveBayes gnb = new GaussianNaiveBayes(feats_train, labels);
        gnb.train();
        double[] out_labels = gnb.apply(feats_test).get_labels();

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

        modshogun.exit_shogun();
    }
开发者ID:joseph-chan,项目名称:rqpersonalsvn,代码行数:25,代码来源:classifier_gaussiannaivebayes_modular.cs


注:本文中的RealFeatures.set_feature_matrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。