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

Extra srcdep parameters and limit the offset of gamma MC for training #1077

Merged
merged 7 commits into from
May 11, 2023

Conversation

SeiyaNozaki
Copy link
Collaborator

This PR implements extra two parameters for source-dep analysis defined in the following slides.
Any comments are welcome, especially the naming of the parameters...!
https://indico.cta-observatory.org/event/4631/contributions/38096/attachments/23113/33203/20230213_srcdep_update.pdf

In addition, this PR changes the default value of `src_r_cut of MC gamma for the RF training.

…rectness) for source-dep analysis and limit the offset of gamma MC for the RF training
@@ -478,10 +478,13 @@ def build_models(filegammas, fileprotons,
# Apply the temporary disp norm regressor and sign classifier to the test set
disp_norm = tmp_reg_disp_norm.predict(test[config['disp_regression_features']])
disp_sign = tmp_cls_disp_sign.predict(test[config['disp_classification_features']])
disp_sign_proba = tmp_cls_disp_sign.predict_proba(test[config['disp_classification_features']])
Copy link
Member

@maxnoe maxnoe Feb 13, 2023

Choose a reason for hiding this comment

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

There is no need to call predict and predict proba, that's wasteful. Since we now want the proba, you should change the disp_sign calculation to use the proba to not evaluate the random forest twice:

col = list(tmp_cls_disp_sign.classes_).index(1)
disp_sign = np.where(disp_sign_proba[:, col] > 0.5, 1, -1)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the comment! Actually, I just copy & paste the codes of gammaness computation, so this part can also be updated to reduce computation time
https://github.com/cta-observatory/cta-lstchain/blob/master/lstchain/reco/dl1_to_dl2.py#L652-L653

@SeiyaNozaki
Copy link
Collaborator Author

CI failed since only a single event survives after off-axis cut (src_r < 1 degree) ...
Is it possible to include several low off-axis events in the test MC gamma dataset?

@rlopezcoto
Copy link
Contributor

CI failed since only a single event survives after off-axis cut (src_r < 1 degree) ... Is it possible to include several low off-axis events in the test MC gamma dataset?

I think it was @maxnoe the one creating those datasets, right? Would it be possible to create one including more inner events now that we have seen an improvement in the performance of src-dependent analysis?
Otherwise we could modify the tests, @SeiyaNozaki aren't there any events surviving because of the cuts (just relax them) or overall without applying any additional constraints?

@rlopezcoto
Copy link
Contributor

so @maxnoe would it be possible to get a different test dataset with more off-axis events or shall we change the tests for them to pass after these conditions are applied?

@maxnoe
Copy link
Member

maxnoe commented May 10, 2023

so @maxnoe would it be possible to get a different test dataset with more off-axis events or shall we change the tests for them to pass after these conditions are applied?

No sure what simulations you are talking about, but I can't remember creating any.

If you need a new small test file with specific settings, you should probably ask the simulation team to create it, like I did here:
cta-observatory/lst-sim-config#51

@SeiyaNozaki
Copy link
Collaborator Author

ah I see Max's comment now, but now I prepared fake DL1 MC gamma file (like fake proton MC) by changing src_x and src_y to zeros to keep events after src_r cut. So now it should work with the current test data.

@codecov
Copy link

codecov bot commented May 10, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.10 🎉

Comparison is base (8fb5cb5) 74.02% compared to head (f8c3347) 74.12%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1077      +/-   ##
==========================================
+ Coverage   74.02%   74.12%   +0.10%     
==========================================
  Files         123      123              
  Lines       11869    11915      +46     
==========================================
+ Hits         8786     8832      +46     
  Misses       3083     3083              
Impacted Files Coverage Δ
lstchain/conftest.py 97.77% <100.00%> (+0.19%) ⬆️
lstchain/io/tests/test_config.py 100.00% <100.00%> (ø)
lstchain/reco/dl1_to_dl2.py 81.66% <100.00%> (+0.76%) ⬆️
lstchain/reco/tests/test_utils.py 100.00% <100.00%> (ø)
lstchain/reco/utils.py 76.38% <100.00%> (+0.86%) ⬆️
lstchain/scripts/tests/test_lstchain_scripts.py 99.65% <100.00%> (+<0.01%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants