Skip to content

Commit

Permalink
enable set_shifts in wds examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Nov 14, 2011
1 parent 6c75752 commit 56afbe6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Expand Up @@ -21,6 +21,7 @@ public static void main(String argv[]) {
StringCharFeatures feats_test = new StringCharFeatures(fm_test_dna, DNA);

WeightedDegreePositionStringKernel kernel = new WeightedDegreePositionStringKernel(feats_train, feats_train, degree);
kernel.set_shifts(DoubleMatrix.ones(1, (fm_train_dna[0]).length()));
kernel.set_position_weights(DoubleMatrix.ones(1, (fm_train_dna[0]).length()));


Expand Down
Expand Up @@ -16,8 +16,8 @@ def kernel_weighted_degree_position_string_modular(fm_train_dna=traindat,fm_test
kernel=WeightedDegreePositionStringKernel(feats_train, feats_train, degree)

from numpy import zeros,ones,float64,int32
#kernel.set_shifts(zeros(len(fm_train_dna[0]), dtype=int32))
#kernel.set_position_weights(ones(len(fm_train_dna[0]), dtype=float64))
kernel.set_shifts(10*ones(len(fm_train_dna[0]), dtype=int32))
kernel.set_position_weights(ones(len(fm_train_dna[0]), dtype=float64))

km_train=kernel.get_kernel_matrix()
kernel.init(feats_train, feats_test)
Expand Down

0 comments on commit 56afbe6

Please sign in to comment.