Skip to content
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

Parallel RF #3322

Merged
merged 7 commits into from Jul 4, 2016
Merged

Parallel RF #3322

merged 7 commits into from Jul 4, 2016

Conversation

Saurabh7
Copy link
Contributor

WIP

CFeatures* shallow_copy_features=nullptr;

SG_SDEBUG("Using underlying feature matrix with %d dimensions and %d feature vectors!\n", num_features, num_vectors);
SGMatrix<ST> shallow_copy_matrix = SGMatrix<ST>(feature_matrix.matrix, num_features, num_vectors, false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use the copy constructor of SGMatrix

@karlnapf
Copy link
Member

So this works?
Whats the gain with increasing number of cores?

@Saurabh7
Copy link
Contributor Author

Yes, it works.
Although calculating oob error is leading to change in values for test.
I suspected this is due to chaning of order in which we append oob indices (multi thread) to dynamic array. So I made it critical for the thread, but still there are some changes.

outputs: https://gist.github.com/Saurabh7/40889d51c856f73c33337408eb3a7fd1

@karlnapf
Copy link
Member

I guess you can force a single thread for the result tests.
Multithread tests can be done on the feature subset shallow copy alone, independently of rf

@Saurabh7
Copy link
Contributor Author

Ok so few things for this:
currently this Mock test which uses mock labels fails: https://github.com/shogun-toolbox/shogun/blob/develop/tests/unit/multiclass/BaggingMachine_unittest.cc#L35. because this shallow_subset_copy method is not implemented in Labels base class.

Regarding If objects are safe to use in other algorithms, get_feature_matrix() returns a copy if subset are present so thats not a problem.
other access methods like get_feature_vector and set_feature_vector will change the data if written using it.

@Saurabh7
Copy link
Contributor Author

Also I found the changes in oob error were because, randomly generated indices in multithreaded version keep chaning even thought I set seed in sg_rand.

@karlnapf
Copy link
Member

karlnapf commented Jul 4, 2016

And merge :)

@karlnapf karlnapf merged commit 2d69784 into shogun-toolbox:develop Jul 4, 2016
@karlnapf
Copy link
Member

karlnapf commented Jul 4, 2016

ah crap, it wasnt squashed ;)
Can you always make sure you squash your commits before asking to merge them?
I know I should check, but there is a lot of stuff going on atm

@Saurabh7
Copy link
Contributor Author

Saurabh7 commented Jul 4, 2016

@karlnapf ah ok sorry :) Next time I will put an explicit comment when final.

karasikov pushed a commit to karasikov/shogun that referenced this pull request Apr 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants