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

Review #4

Open
wants to merge 7 commits into
base: empty
Choose a base branch
from
Open

Review #4

wants to merge 7 commits into from

Conversation

ameenetemady
Copy link
Collaborator

No description provided.

screen_index <- function(simulator) {
method = simulator$setting[["method"]]
if (method != "Random" && method != "Expert") {
metric_fun = switch(simulator$setting[["method"]],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems better to define a get_metric_fun function instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

This module is only used once. It would be necessary to put it in a function if it were used in multiple places.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct, that's one of the reasons for adding a function, the other one being readability.

iter_num = simulator$setting[["iter_num"]]
simulator$errors = as.numeric()
prepare_data(simulator)
for (i in 1:iter_num) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

very complex, nested for loop. Simplify this (maybe use Extract Method with good function names to help understand this.

Copy link
Contributor

@wmmxk wmmxk Feb 1, 2020

Choose a reason for hiding this comment

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

The nested for loop has two levels. One is for (i in 1:iter_num) and the other is for (gene_id in gene_ids). The meaning of each level is clear, and not so complicated, although nested for loop is not encouraged.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I still think this should change.


compute_MI_denominator <- function(simulator){

d = simulator$model[["numDim"]]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

renamed or at least put a comment on what it means.

Copy link
Contributor

Choose a reason for hiding this comment

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

renamed it as num_of_features.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Still not changed.


MI_metric <-function(simulator){
res = predict_testset(simulator,simulator$pool[, 1:14], unfold=TRUE)
var = res$var
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

var: this intermediate variable is not needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's still there.


update_train_pool <- function (simulator,select_index) {

add = simulator$setting[["add"]]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

add is not a good name.

Copy link
Contributor

Choose a reason for hiding this comment

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

rename as batch_size.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The variable name is still not changed.

Copy link
Collaborator Author

@ameenetemady ameenetemady left a comment

Choose a reason for hiding this comment

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

I'm now finished one round of review (in addition to issues 2 and 3).
IMO, the code is good overall, I raised the issues that I came across.

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.

2 participants