Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #430 from gsomix/sparse_octave
Sparse matrix typemap for octave modular.
- Loading branch information
Showing
2 changed files
with
109 additions
and
2 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
examples/undocumented/octave_modular/features_sparse_modular.m
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,26 @@ | ||
init_shogun | ||
rand('state',0); | ||
|
||
disp('Sparse Features') | ||
|
||
A=rand(3,5); | ||
A(A<0.7)=0; | ||
full(A) | ||
|
||
% sparse representation X of dense matrix A | ||
X = sparse(A) | ||
|
||
% create sparse shogun features from dense matrix A | ||
a=SparseRealFeatures(A) | ||
a_out = a.get_full_feature_matrix() | ||
|
||
% create sparse shogun features from sparse matrix X | ||
a.set_sparse_feature_matrix(X) | ||
a_out=a.get_full_feature_matrix() | ||
|
||
% create sparse shogun features from sparse matrix X | ||
a=SparseRealFeatures(X) | ||
a_out=a.get_full_feature_matrix() | ||
|
||
z=a.get_sparse_feature_matrix() | ||
|
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