-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replacing undocumented python example for Sparse Euclidian Distance with a meta-example #4945
Merged
vigsterkr
merged 5 commits into
shogun-toolbox:develop
from
Hephaestus12:feature/metaExample
Apr 3, 2020
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6a65860
Replacing undocumented python example for Sparse Euclidian Distance w…
Hephaestus12 730583a
Delete the python example
Hephaestus12 b8103a1
BROKEN BUILD, make changes to factory.h to account for sparse features
Hephaestus12 c1f4845
added facility to chek filename and then decide if sparse or dense fe…
Hephaestus12 3e0f2d0
compare type_index instead of filename
Hephaestus12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,20 @@ | ||
LibSVMFile f_feats_a("@SHOGUN_DATA@/fm_train_sparsereal.dat") | ||
LibSVMFile f_feats_b("@SHOGUN_DATA@/fm_test_sparsereal.dat") | ||
|
||
#![create_features] | ||
Features features_a = features(f_feats_a) | ||
Features features_b = features(f_feats_b) | ||
#![create_features] | ||
|
||
#![create_instance] | ||
Distance d = distance("SparseEuclideanDistance", lhs=features_a, rhs=features_a) | ||
#![create_instance] | ||
|
||
#![extract_distance] | ||
RealMatrix distance_matrix_aa = d.get_distance_matrix() | ||
#![extract_distance] | ||
|
||
#![refresh_distance] | ||
d.init(features_a, features_b) | ||
RealMatrix distance_matrix_ab = d.get_distance_matrix() | ||
#![refresh_distance] |
This file was deleted.
Oops, something went wrong.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as the documentation stats SparseEuclideanDistance is expecting SparseFeatures.... imo the features you are reading above are not SparseFeatures but DenseFeatures.
plz make sure that you compile and test your changes before sending in a PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all the other examples(
.sg.in
files),features_a
andfeatures_b
are defined as variables of theFeatures
class, and they directly become DenseFeatures by calling the constructor of theCDenseFeatures
class.How should we ensure that the features are sparse and the constructor of the
CSparseFeatures
class is called?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
none of the examples are actually using methods that requires SparseFeatures... for that actually you'll need to patch factory.h to be able to read sparse format (say libsvmfile) and create a SparseFeature from it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might be a bit beyond an entrance task so might be worth starting an issue and then rebase this when it’s done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nvm! Does it work? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Started new issue #4947