Skip to content

Instantly share code, notes, and snippets.

@OXPHOS
Last active May 28, 2016 11:27
Show Gist options
  • Select an option

  • Save OXPHOS/36a3c1f58cb657ab2f5ff86045238e6f to your computer and use it in GitHub Desktop.

Select an option

Save OXPHOS/36a3c1f58cb657ab2f5ff86045238e6f to your computer and use it in GitHub Desktop.
with ruby pda.get_cov() error
CSVFile f_feats_train("../../data/classifier_4class_2d_linear_features_train.dat")
CSVFile f_feats_test("../../data/classifier_4class_2d_linear_features_test.dat")
CSVFile f_labels_train("../../data/classifier_4class_2d_linear_labels_train.dat")
CSVFile f_labels_test("../../data/classifier_4class_2d_linear_labels_test.dat")
#![create_features]
RealFeatures features_train(f_feats_train)
RealFeatures features_test(f_feats_test)
MulticlassLabels labels_train(f_labels_train)
MulticlassLabels labels_test(f_labels_test)
#![create_features]
#![create_instance]
QDA qda(features_train, labels_train)
#![create_instance]
#![train_and_apply]
qda.train()
MulticlassLabels labels_predict = qda.apply_multiclass(features_test)
#![train_and_apply]
#![extract_mean_and_cov]
int classlabel = 1
RealVector m = qda.get_mean(classlabel)
RealMatrix c = qda.get_cov(classlabel)
#![train_and_apply]
#![evaluate_accuracy]
MulticlassAccuracy eval()
real accuracy = eval.evaluate(labels_predict, labels_test)
#![evaluate_accuracy]
# additional integration testing variables
RealVector output = labels_predict.get_labels()
@OXPHOS
Copy link
Copy Markdown
Author

OXPHOS commented May 27, 2016

$ ruby ruby/classifier/qda.rb

/Library/Ruby/Site/2.0.0/universal-darwin14/modshogun.bundle: warning: rb_define_const: invalid name `__MAC_10_8' for constant
[ERROR] In file /Users/zora/Github/shogun/src/shogun/io/File.cpp line 71: Error opening file '../../data/classifier_4class_2d_linear_features_train.dat'
ruby/classifier/qda.rb:3:in `initialize': [ERROR] In file /Users/zora/Github/shogun/src/shogun/io/File.cpp line 71: Error opening file '../../data/classifier_4class_2d_linear_features_train.dat' (fatal)
    from ruby/classifier/qda.rb:3:in `new'
    from ruby/classifier/qda.rb:3:in `<main>'

@karlnapf
Copy link
Copy Markdown

this error comes from file not found, as the error says. So the path is probably wrong.
Can you post the generated ruby listing as well. I get a different error when trying to reproduce locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment