public 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);

    NormOne preproc = new NormOne();
    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();

    System.out.println(km_train.toString());
    System.out.println(km_test.toString());
  }
  public static void main(String argv[]) {
    modshogun.init_shogun_with_defaults();
    double width = 2.1;
    double epsilon = 1e-5;
    double C = 1.0;
    int mkl_norm = 2;

    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");

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

    RealFeatures subkfeats1_train = new RealFeatures(traindata_real);
    RealFeatures subkfeats1_test = new RealFeatures(testdata_real);

    GaussianKernel subkernel = new GaussianKernel(10, width);
    feats_train.append_feature_obj(subkfeats1_train);
    feats_test.append_feature_obj(subkfeats1_test);
    kernel.append_kernel(subkernel);

    RealFeatures subkfeats2_train = new RealFeatures(traindata_real);
    RealFeatures subkfeats2_test = new RealFeatures(testdata_real);

    LinearKernel subkernel2 = new LinearKernel();
    feats_train.append_feature_obj(subkfeats2_train);
    feats_test.append_feature_obj(subkfeats2_test);
    kernel.append_kernel(subkernel2);

    RealFeatures subkfeats3_train = new RealFeatures(traindata_real);
    RealFeatures subkfeats3_test = new RealFeatures(testdata_real);

    PolyKernel subkernel3 = new PolyKernel(10, 2);
    feats_train.append_feature_obj(subkfeats3_train);
    feats_test.append_feature_obj(subkfeats3_test);
    kernel.append_kernel(subkernel3);

    kernel.init(feats_train, feats_train);

    Labels labels = new Labels(trainlab);

    MKLMultiClass mkl = new MKLMultiClass(C, kernel, labels);
    mkl.set_epsilon(epsilon);
    mkl.set_mkl_epsilon(epsilon);
    mkl.set_mkl_norm(mkl_norm);

    mkl.train();

    kernel.init(feats_train, feats_test);
    DoubleMatrix out = mkl.apply().get_labels();

    modshogun.exit_shogun();
  }
  public static void main(String argv[]) {
    boolean reverse = false;
    modshogun.init_shogun_with_defaults();
    int order = 3;
    int gap = 4;

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

    StringCharFeatures charfeat = new StringCharFeatures(fm_train_dna, DNA);
    StringWordFeatures feats = new StringWordFeatures(charfeat.get_alphabet());
    feats.obtain_from_char(charfeat, order - 1, order, gap, reverse);

    PositionalPWM ppwm = new PositionalPWM();
    ppwm.set_sigma(5.0);
    ppwm.set_mean(10.0);
    DoubleMatrix pwm =
        new DoubleMatrix(
            new double[][] {
              {0.0, 0.5, 0.1, 1.0}, {0.0, 0.5, 0.5, 0.0}, {1.0, 0.0, 0.4, 0.0}, {0.0, 0.0, 0.0, 0.0}
            });
    ppwm.set_pwm(logi(pwm));
    ppwm.compute_w(20);
    DoubleMatrix w = ppwm.get_w();
    modshogun.exit_shogun();
  }
  public static void main(String argv[]) {
    modshogun.init_shogun_with_defaults();

    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);

    EuclideanDistance distance = new EuclideanDistance(feats_train, feats_train);

    DoubleMatrix dm_train = distance.get_distance_matrix();
    distance.init(feats_train, feats_test);
    DoubleMatrix dm_test = distance.get_distance_matrix();

    System.out.println(dm_train.toString());
    System.out.println(dm_test.toString());
  }
  public static void main(String argv[]) {
    modshogun.init_shogun_with_defaults();

    DoubleMatrix ground_truth = Load.load_labels("../data/label_train_twoclass.dat");
    DoubleMatrix predicted = randn(1, ground_truth.getLength());

    Labels ground_truth_labels = new Labels(ground_truth);
    Labels predicted_labels = new Labels(predicted);

    ROCEvaluation evaluator = new ROCEvaluation();
    evaluator.evaluate(predicted_labels, ground_truth_labels);

    System.out.println(evaluator.get_ROC());
    System.out.println(evaluator.get_auROC());

    modshogun.exit_shogun();
  }
  public static void main(String argv[]) {
    modshogun.init_shogun_with_defaults();

    DoubleMatrix ground_truth = Load.load_labels("../data/label_train_twoclass.dat");
    DoubleMatrix predicted = randn(1, ground_truth.getLength());

    Labels ground_truth_labels = new Labels(ground_truth);
    Labels predicted_labels = new Labels(predicted);

    ContingencyTableEvaluation base_evaluator = new ContingencyTableEvaluation();
    base_evaluator.evaluate(predicted_labels, ground_truth_labels);

    AccuracyMeasure evaluator1 = new AccuracyMeasure();
    double accuracy = evaluator1.evaluate(predicted_labels, ground_truth_labels);

    ErrorRateMeasure evaluator2 = new ErrorRateMeasure();
    double errorrate = evaluator2.evaluate(predicted_labels, ground_truth_labels);

    BALMeasure evaluator3 = new BALMeasure();
    double bal = evaluator3.evaluate(predicted_labels, ground_truth_labels);

    WRACCMeasure evaluator4 = new WRACCMeasure();
    double wracc = evaluator4.evaluate(predicted_labels, ground_truth_labels);

    F1Measure evaluator5 = new F1Measure();
    double f1 = evaluator5.evaluate(predicted_labels, ground_truth_labels);

    CrossCorrelationMeasure evaluator6 = new CrossCorrelationMeasure();
    double crosscorrelation = evaluator6.evaluate(predicted_labels, ground_truth_labels);

    RecallMeasure evaluator7 = new RecallMeasure();
    double recall = evaluator7.evaluate(predicted_labels, ground_truth_labels);

    PrecisionMeasure evaluator8 = new PrecisionMeasure();
    double precision = evaluator8.evaluate(predicted_labels, ground_truth_labels);

    SpecificityMeasure evaluator9 = new SpecificityMeasure();
    double specificity = evaluator9.evaluate(predicted_labels, ground_truth_labels);

    System.out.printf(
        "%f, %f, %f, %f, %f, %f, %f, %f, %f\n",
        accuracy, errorrate, bal, wracc, f1, crosscorrelation, recall, precision, specificity);

    modshogun.exit_shogun();
  }
  public static void main(String argv[]) {
    boolean reverse = false;
    modshogun.init_shogun_with_defaults();
    int N = 1;
    int M = 512;
    double pseudo = 1e-5;
    int order = 3;
    int gap = 0;

    String[] fm_train_dna = Load.load_cubes("../data/fm_train_cube.dat");

    StringCharFeatures charfeat = new StringCharFeatures(fm_train_dna, CUBE);
    StringWordFeatures feats = new StringWordFeatures(charfeat.get_alphabet());
    feats.obtain_from_char(charfeat, order - 1, order, gap, reverse);

    HMM hmm = new HMM(feats, N, M, pseudo);
    hmm.train();
    hmm.baum_welch_viterbi_train(BW_NORMAL);

    int num_examples = feats.get_num_vectors();
    int num_param = hmm.get_num_model_parameters();
    for (int i = 0; i < num_examples; i++)
      for (int j = 0; j < num_param; j++) {
        hmm.get_log_derivative(j, i);
      }

    int best_path = 0;
    int best_path_state = 0;
    for (int i = 0; i < num_examples; i++) {
      best_path += hmm.best_path(i);
      for (int j = 0; j < N; j++) best_path_state += hmm.get_best_path_state(i, j);
    }

    DoubleMatrix lik_example = hmm.get_log_likelihood();
    double lik_sample = hmm.get_log_likelihood_sample();

    modshogun.exit_shogun();
  }
  static ArrayList run(int para) {
    modshogun.init_shogun_with_defaults();
    int k = para;
    init_random(17);

    DoubleMatrix fm_train = Load.load_numbers("../data/fm_train_real.dat");

    RealFeatures feats_train = new RealFeatures(fm_train);
    EuclidianDistance distance = new EuclidianDistance(feats_train, feats_train);

    KMeans kmeans = new KMeans(k, distance);
    kmeans.train();

    DoubleMatrix out_centers = kmeans.get_cluster_centers();
    kmeans.get_radiuses();

    ArrayList result = new ArrayList();
    result.add(kmeans);
    result.add(out_centers);

    modshogun.exit_shogun();
    return result;
  }