Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:shogun-toolbox/shogun
- Loading branch information
Showing
6 changed files
with
325 additions
and
85 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
|
||
public class VectorTest | ||
{ | ||
public static void Main(string[] args) { | ||
modshogun.init_shogun_with_defaults(); | ||
|
||
double[] y = new double[4] {1, 2, 3, 4}; | ||
Labels x = new Labels(y); | ||
double[] r = x.get_labels(); | ||
for (int i = 0; i < r.Length; i++) { | ||
Console.WriteLine(r[i]); | ||
} | ||
|
||
modshogun.exit_shogun(); | ||
|
||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
examples/undocumented/ruby_modular/kernel_linear_byte_modular.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require 'narray' | ||
require 'modshogun' | ||
require 'load' | ||
require 'pp' | ||
|
||
traindat = LoadMatrix.load_numbers('../data/fm_train_byte.dat') | ||
testdat = LoadMatrix.load_numbers('../data/fm_test_byte.dat') | ||
|
||
parameter_list=[[traindat,testdat],[traindat,testdat]] | ||
|
||
def kernel_linear_byte_modular(fm_train_byte=traindat,fm_test_byte=testdat) | ||
pp fm_train_byte | ||
feats_train=Modshogun::ByteFeatures.new(fm_train_byte) | ||
feats_test=Modshogun::ByteFeatures.new(fm_test_byte) | ||
|
||
kernel=Modshogun::LinearKernel.new(feats_train, feats_train) | ||
km_train=kernel.get_kernel_matrix() | ||
|
||
kernel.init(feats_train, feats_test) | ||
km_test=kernel.get_kernel_matrix() | ||
pp " km_train", km_train | ||
pp " km_test", km_test | ||
return kernel | ||
end | ||
|
||
if __FILE__ == $0 | ||
print 'LinearByte' | ||
kernel_linear_byte_modular(*parameter_list[0]) | ||
end |
30 changes: 30 additions & 0 deletions
30
examples/undocumented/ruby_modular/kernel_linear_word_modular.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'narray' | ||
require 'modshogun' | ||
require 'load' | ||
require 'pp' | ||
|
||
traindat = LoadMatrix.load_numbers('../data/fm_train_word.dat') | ||
testdat = LoadMatrix.load_numbers('../data/fm_test_word.dat') | ||
|
||
parameter_list=[[traindat,testdat,1.2],[traindat,testdat,1.2]] | ||
|
||
def kernel_linear_word_modular(fm_train_word=traindat,fm_test_word=testdat,scale=1.2) | ||
feats_train=Modshogun::WordFeatures.new(fm_train_word) | ||
feats_test=Modshogun::WordFeatures.new(fm_test_word) | ||
|
||
kernel=Modshogun::LinearKernel.new(feats_train, feats_train) | ||
kernel.set_normalizer(Modshogun::AvgDiagKernelNormalizer.new(scale)) | ||
kernel.init(feats_train, feats_train) | ||
|
||
km_train=kernel.get_kernel_matrix() | ||
kernel.init(feats_train, feats_test) | ||
km_test=kernel.get_kernel_matrix() | ||
pp " km_train", km_train | ||
pp " km_test", km_test | ||
return kernel | ||
end | ||
|
||
if __FILE__ == $0 | ||
print 'LinearWord' | ||
kernel_linear_word_modular(*parameter_list[0]) | ||
end |
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
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
Oops, something went wrong.