-
Notifications
You must be signed in to change notification settings - Fork 33
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
Celltype annotation automl #423
Conversation
dance/pipeline.py
Outdated
@@ -835,6 +849,22 @@ def save_summary_data(entity, project, sweep_id, summary_file_path): | |||
result.update({"id": run.id}) | |||
summary_data.append(flatten_dict(result)) # get result and config | |||
ans = pd.DataFrame(summary_data).set_index(["id"]) | |||
conf = OmegaConf.load(conf_load_path) |
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.
Change the column names of the summary table
for x in row: | ||
for k in conf.pipeline: | ||
if k["target"] == x: | ||
pipeline.append(k) | ||
for i, f in zip(required_indexes, required_funs): |
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.
Some necessary functions, such as setConfig, can be obtained from the yaml of step 2 instead of the default yaml of step 3.
dance/pipeline.py
Outdated
count += 1 | ||
|
||
|
||
def run_step3(MAINDIR, evaluate_pipeline, step2_pipeline_planer: PipelinePlaner, tune_mode="params", sweep_id=None): |
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.
The step3 function is run by default
parser = argparse.ArgumentParser() | ||
parser.add_argument("--batch_size", type=int, default=500) | ||
parser.add_argument("--cache", action="store_true", help="Cache processed data.") | ||
# parser.add_argument("--dense_dim", type=int, default=400, help="number of hidden gcn units") |
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.
There are hyperparameters that both the preprocessing function and the model depend on. Delete them and read them through the configuration file.
parser.add_argument("--valid_dataset", nargs="+", default=[1970], help="List of valid dataset ids.") | ||
parser.add_argument("--seed", type=int, default=0, help="Initial seed random, offset for each repeatition") | ||
|
||
parser.add_argument("--tune_mode", default="pipeline_params", choices=["pipeline", "params", "pipeline_params"]) |
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.
Need to add some parameters
parser.add_argument("--log_level", type=str, default="INFO", choices=get_args(LogLevel)) | ||
parser.add_argument("--species", default="mouse") | ||
parser.add_argument("--test_dataset", nargs="+", default=[2695], type=int, help="list of dataset id") | ||
parser.add_argument("--tissue", default="Brain") # TODO: Add option for different tissue name for train/test | ||
parser.add_argument("--train_dataset", nargs="+", default=[753], type=int, help="list of dataset id") | ||
parser.add_argument("--valid_dataset", nargs="+", default=[3285], type=int, help="list of dataset id") | ||
parser.add_argument("--tune_mode", default="pipeline", choices=["pipeline", "params"]) | ||
parser.add_argument("--tune_mode", default="pipeline_params", choices=["pipeline", "params", "pipeline_params"]) |
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.
Add new tune_mode
self.train2valid() | ||
|
||
def train2valid(self): | ||
logger.info("Copy train_dataset and use it as valid_dataset") |
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.
train_dataset can be used as valid_dataset when needed
dance/transforms/normalize.py
Outdated
n_cells: Optional[int] = None, | ||
bin_size: int = 500, | ||
bw_adjust: float = 3, | ||
processes_num=os.cpu_count(), |
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.
The number of processes needs to be parameterized
args = parser.parse_args() | ||
logger.setLevel(args.log_level) | ||
logger.info(f"\n{pprint.pformat(vars(args))}") | ||
MAINDIR = Path(__file__).resolve().parent | ||
pipeline_planer = PipelinePlaner.from_config_file(f"{MAINDIR}/{args.config_dir}{args.tune_mode}_tuning_config.yaml") | ||
file_root_path = Path( |
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.
Currently, the name of the data set is used as the folder, and the name of the biological tissue can also be used.
|
||
|
||
def run_step3(root_path, evaluate_pipeline, step2_pipeline_planer: PipelinePlaner, tune_mode="params"): | ||
"""Run step 3 by default. |
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.
Run step 3 by default.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
… celltype_annotation_automl
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
… celltype_annotation_automl
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
… celltype_annotation_automl
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
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.
LGTM
@@ -117,6 +117,27 @@ def __call__(self, data): | |||
data.data.raw = data.data.copy() | |||
|
|||
|
|||
@register_preprocessor("misc") | |||
class UpdateRaw(BaseTransform): | |||
"""Update raw data. |
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.
UpdateRaw
is confusing. Change to something like AlignRaw
to more accurately reflect its function.
Complete the automl task about celltype_annotation. Currently, for each celltype annotation algorithm task, a data set is arbitrarily selected for a full set run. Due to the merge time problem, it does not end completely, but it is close to the complete run. I will wait until this merge is completed before resuming operation.