Last active
August 29, 2015 13:56
-
-
Save karlnapf/9079385 to your computer and use it in GitHub Desktop.
An abstract Shogun example language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <shogun/kernel/GaussianKernel.h> | |
#include <shogun/features/DenseFeatures.h> | |
using namespace shogun; | |
int main(int argc, char** argv) | |
{ | |
init_shogun_with_defaults(); | |
// comment: strongly typed c++ kind of style here, but doesn't have to be | |
CCSVFile* file=new CCSVFile("filename", 'w'); | |
SG_REF(file); | |
CDenseFeatures<float64_t>* features=CDenseFeatures<float64_t>(file); | |
SG_REF(features); | |
float64_t kernel_width=2; | |
CGaussianKernel* kernel=new CGaussianKernel(kernel_width); | |
SG_REF(kernel); | |
kernel->init(features, features); | |
SGMatrix<float64_t> K=kernel.get_kernel_matrix(); | |
// some code to serialise all Shogun objects for integration testing | |
// ... | |
SG_UNREF(file); | |
SG_UNREF(features); | |
SG_UNREF(kernel); | |
exit_shogun(); | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
modshogun | |
% comment: strongly typed c++ kind of style here, but doesn't have to be | |
file=CSVFile('filename'); | |
features=RealFeatures(file); | |
kernel_width=2; | |
kernel=GaussianKernel(kernel_width); | |
K=kernel.get_kernel_matrix(); | |
% some code to serialise all Shogun objects for integration testing | |
% ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def example (): | |
from modshogun import RealFeatures, GaussianKernel, CSVFile | |
# comment: strongly typed c++ kind of style here, but doesn't have to be | |
file=CSVFile("filename"); | |
features=RealFeatures(file); | |
kernel_width=2; | |
kernel=GaussianKernel(kernel_width); | |
K=kernel.get_kernel_matrix(); | |
# some code to serialise all Shogun objects for integration testing | |
# ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// comment: strongly typed c++ kind of style here, but doesn't have to be | |
CCSVFile file=CCSVFile("filename"); | |
RealFeatures features=RealFeatures(file); | |
float64 kernel_width=2; | |
GaussianKernel kernel=GaussianKernel(kernel_width); | |
SGMatrix<float64> K=kernel.get_kernel_matrix(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would go for extension .sg.