Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

An abstract Shogun example language

View Shogun_language.sho
1 2 3 4 5 6
// 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();
View Shogun_language.sho
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#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;
}
View Shogun_language.sho
1 2 3 4 5 6 7 8 9 10 11
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
% ...
View Shogun_language.sho
1 2 3 4 5 6 7 8 9 10 11 12
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
# ...

I would go for extension .sg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.