本文整理汇总了C#中RealFeatures类的典型用法代码示例。如果您正苦于以下问题:C# RealFeatures类的具体用法?C# RealFeatures怎么用?C# RealFeatures使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RealFeatures类属于命名空间,在下文中一共展示了RealFeatures类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: run
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");
RealFeatures feats_train = new RealFeatures(traindata_real);
RealFeatures feats_test = new RealFeatures(testdata_real);
ANOVAKernel kernel = new ANOVAKernel(feats_train, feats_train, cardinality, size_cache);
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;
}
开发者ID:orico,项目名称:shogun,代码行数:26,代码来源:kernel_anova_modular.cs
示例2: 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
示例3: 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
示例4: Main
public static void Main()
{
modshogun.init_shogun_with_defaults();
double degree = 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(traindata_real);
RealFeatures feats_test = new RealFeatures(testdata_real);
EuclidianDistance distance = new EuclidianDistance(feats_train, feats_train);
PowerKernel kernel = new PowerKernel(feats_train, feats_test, degree, distance);
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();
}
开发者ID:joseph-chan,项目名称:rqpersonalsvn,代码行数:27,代码来源:kernel_power_modular.cs
示例5: Main
static void Main(string[] argv)
{
modshogun.init_shogun_with_defaults();
double width = 1.4;
int size_cache = 10;
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(traindata_real);
RealFeatures feats_test = new RealFeatures(testdata_real);
RandomFourierGaussPreproc preproc = new RandomFourierGaussPreproc();
preproc.init(feats_train);
feats_train.add_preprocessor(preproc);
feats_train.apply_preprocessor();
feats_test.add_preprocessor(preproc);
feats_test.apply_preprocessor();
Chi2Kernel kernel = new Chi2Kernel(feats_train, feats_train, width, size_cache);
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();
}
开发者ID:orico,项目名称:shogun,代码行数:30,代码来源:preprocessor_randomfouriergausspreproc_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");
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
示例7: Main
public static void Main() {
modshogun.init_shogun_with_defaults();
double width = 0.8;
int C = 1;
double epsilon = 1e-5;
double tube_epsilon = 1e-2;
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(traindata_real);
RealFeatures feats_test = new RealFeatures(testdata_real);
GaussianKernel kernel= new GaussianKernel(feats_train, feats_train, width);
Labels labels = new Labels(trainlab);
LibSVR svr = new LibSVR(C, epsilon, kernel, labels);
svr.set_tube_epsilon(tube_epsilon);
svr.train();
kernel.init(feats_train, feats_test);
double[] out_labels = svr.apply().get_labels();
foreach (double item in out_labels)
Console.Write(out_labels);
modshogun.exit_shogun();
}
开发者ID:Anshul-Bansal,项目名称:gsoc,代码行数:32,代码来源:regression_libsvr_modular.cs
示例8: Main
public static void Main()
{
modshogun.init_shogun_with_defaults();
double width = 0.8;
int C = 1;
double epsilon = 1e-5;
double tube_epsilon = 1e-2;
int num_threads = 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(traindata_real);
RealFeatures feats_test = new RealFeatures(testdata_real);
GaussianKernel kernel= new GaussianKernel(feats_train, feats_train, width);
RegressionLabels labels = new RegressionLabels(trainlab);
SVRLight svr = new SVRLight(C, epsilon, kernel, labels);
svr.set_tube_epsilon(tube_epsilon);
//svr.parallel.set_num_threads(num_threads);
svr.train();
kernel.init(feats_train, feats_test);
double[] out_labels = RegressionLabels.obtain_from_generic(svr.apply()).get_labels();
foreach (double item in out_labels)
Console.Write(item);
modshogun.exit_shogun();
}
开发者ID:behollis,项目名称:muViewBranch,代码行数:33,代码来源:regression_svrlight_modular.cs
示例9: Main
public static void Main()
{
modshogun.init_shogun_with_defaults();
double width = 0.8;
double tau = 1e-6;
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(traindata_real);
RealFeatures feats_test = new RealFeatures(testdata_real);
GaussianKernel kernel= new GaussianKernel(feats_train, feats_train, width);
Labels labels = new Labels(trainlab);
KRR krr = new KRR(tau, kernel, labels);
krr.train(feats_train);
kernel.init(feats_train, feats_test);
double[] out_labels = krr.apply().get_labels();
foreach(double item in out_labels) {
Console.Write(item);
}
modshogun.exit_shogun();
}
开发者ID:joseph-chan,项目名称:rqpersonalsvn,代码行数:29,代码来源:regression_krr_modular.cs
示例10: 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
示例11: Main
public static void Main() {
modshogun.init_shogun_with_defaults();
double width = 1.6;
double[,] train_real = Load.load_numbers("../data/fm_train_real.dat");
double[] trainlab = Load.load_labels("../data/label_train_twoclass.dat");
RealFeatures feats_train = new RealFeatures(train_real);
GaussianKernel subkernel = new GaussianKernel(feats_train, feats_train, width);
Labels labels = new Labels(trainlab);
AUCKernel kernel = new AUCKernel(0, subkernel);
kernel.setup_auc_maximization(labels);
double[,] km_train = kernel.get_kernel_matrix();
int numRows = km_train.GetLength(0);
int numCols = km_train.GetLength(1);
Console.Write("km_train:\n");
for(int i = 0; i < numRows; i++){
for(int j = 0; j < numCols; j++){
Console.Write(km_train[i,j] +" ");
}
Console.Write("\n");
}
modshogun.exit_shogun();
}
开发者ID:Anshul-Bansal,项目名称:gsoc,代码行数:31,代码来源:kernel_auc_modular.cs
示例12: 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
示例13: Main
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();
}
开发者ID:orico,项目名称:shogun,代码行数:31,代码来源:features_simple_modular.cs
示例14: 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
示例15: Main
public static void Main()
{
modshogun.init_shogun_with_defaults();
double width = 1.3;
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(traindata_real);
RealFeatures feats_test = new RealFeatures(testdata_real);
GaussianKernel kernel = new GaussianKernel(feats_train, feats_train, width);
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();
}
开发者ID:JingheZ,项目名称:shogun,代码行数:27,代码来源:kernel_gaussian_modular.cs
示例16: 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
示例17: 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
示例18: Main
static void Main(string[] argv)
{
modshogun.init_shogun_with_defaults();
int num = 1000;
double dist = 1.0;
double width = 2.1;
double C = 1.0;
DoubleMatrix offs =ones(2, num).mmul(dist);
DoubleMatrix x = randn(2, num).sub(offs);
DoubleMatrix y = randn(2, num).add(offs);
DoubleMatrix traindata_real = concatHorizontally(x, y);
DoubleMatrix m = randn(2, num).sub(offs);
DoubleMatrix n = randn(2, num).add(offs);
DoubleMatrix testdata_real = concatHorizontally(m, n);
DoubleMatrix o = ones(1,num);
DoubleMatrix trainlab = concatHorizontally(o.neg(), o);
DoubleMatrix testlab = concatHorizontally(o.neg(), o);
RealFeatures feats_train = new RealFeatures(traindata_real);
RealFeatures feats_test = new RealFeatures(testdata_real);
GaussianKernel kernel = new GaussianKernel(feats_train, feats_train, width);
Labels labels = new Labels(trainlab);
LibSVM svm = new LibSVM(C, kernel, labels);
svm.train();
DoubleMatrix @out = svm.apply(feats_test).get_labels();
Console.WriteLine("Mean Error = " + signum(@out).ne(testlab).mean());
modshogun.exit_shogun();
}
开发者ID:orico,项目名称:shogun,代码行数:34,代码来源:classifier_libsvm_minimal_modular.cs
示例19: Main
public static void Main()
{
modshogun.init_shogun_with_defaults();
double shift_coef = 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(traindata_real);
RealFeatures feats_test = new RealFeatures(testdata_real);
EuclideanDistance distance = new EuclideanDistance(feats_train, feats_train);
MultiquadricKernel kernel = new MultiquadricKernel(feats_train, feats_test, shift_coef, distance);
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();
}
开发者ID:JingheZ,项目名称:shogun,代码行数:29,代码来源:kernel_multiquadric_modular.cs
示例20: Main
static void Main(string[] argv)
{
modshogun.init_shogun_with_defaults();
double sigma = 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(traindata_real);
RealFeatures feats_test = new RealFeatures(testdata_real);
EuclidianDistance distance = new EuclidianDistance(feats_train, feats_train);
CauchyKernel kernel = new CauchyKernel(feats_train, feats_train, sigma, distance);
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();
}
开发者ID:orico,项目名称:shogun,代码行数:25,代码来源:kernel_cauchy_modular.cs
注:本文中的RealFeatures类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论