Best Python code snippet using autotest_python
check_top_results_and_by_model.py
Source:check_top_results_and_by_model.py
...30 result = dict(sorted(result.items(), key=lambda item: item[1], reverse=True))31 return result32def analyze(input_dirs):33 results: List[ResultsSummary] = load_results(input_dirs)34 iteration_results: List[IterationResults] = get_iteration_results(results)35 iteration_results = sorted(iteration_results, key=lambda it_results: get_f1_sum_dev(it_results), reverse=True)36 best_results = iteration_results[:30]37 # IterationResults.to_df_multiple(best_results[:30], "output/websites/top30.csv")38 # experiments_distribution = count_experiments_distribution(best_results, by=lambda ir: ir.experiment_name)39 # models_distribution = count_experiments_distribution(best_results, by=lambda ir: get_model_name(ir.experiment_name))40 detailed_analysis(best_results)41 z = 142def detailed_analysis(iteration_results: List[IterationResults]):43 top_10_by_model = count_experiments_distribution(iteration_results[:10],44 by=lambda ir: get_model_name(ir.experiment_name))45 top_10_by_lr = count_experiments_distribution(iteration_results[:10],46 by=lambda ir: get_lr(ir.experiment_name))47 top_10_by_wd = count_experiments_distribution(iteration_results[:10],48 by=lambda ir: get_wd(ir.experiment_name))49 top_20_by_model = count_experiments_distribution(iteration_results[:20],50 by=lambda ir: get_model_name(ir.experiment_name))51 top_20_by_lr = count_experiments_distribution(iteration_results[:20],52 by=lambda ir: get_lr(ir.experiment_name))53 top_20_by_wd = count_experiments_distribution(iteration_results[:20],54 by=lambda ir: get_wd(ir.experiment_name))55 top_30_by_model = count_experiments_distribution(iteration_results[:30],56 by=lambda ir: get_model_name(ir.experiment_name))57 top_30_by_lr = count_experiments_distribution(iteration_results[:30],58 by=lambda ir: get_lr(ir.experiment_name))59 top_30_by_wd = count_experiments_distribution(iteration_results[:30],60 by=lambda ir: get_wd(ir.experiment_name))61 z = 162def get_f1_sum_dev(iteration_results: IterationResults):63 return iteration_results.dev_results.f11 + iteration_results.dev_results.f1064def r5(value):65 return round(value, 5)66def get_experiment_pretty_name(name):67 file_name = re.search(".*(test.*)", name).group(1)68 for k, v in NAMES_MAP.items():69 if k in file_name:70 file_name = file_name.replace(k, v)71 break72 return file_name.replace("_", "\\_")73def print_top(dirs_with_experiments, set_attribute):74 results: List[ResultsSummary] = load_results_summaries(dirs_with_experiments)75 iteration_results: List[IterationResults] = get_iteration_results(results)76 iteration_results = sorted(iteration_results,77 key=lambda it_results: getattr(it_results, set_attribute).f10 + getattr(it_results,78 set_attribute).f11,79 reverse=True)80 best_10_subject_results_with_positions = get_top_10_subject_results(iteration_results)81 best_10_subject_results = [result[1] for result in best_10_subject_results_with_positions]82 best_subject_position = best_10_subject_results_with_positions[0][0]83 best_10_video_results = iteration_results[:10]84 worst_10_video_results_that_are_still_better_than_top1_subject = iteration_results[85 best_subject_position - 10:best_subject_position]86 for top_10_results in [best_10_video_results,87 worst_10_video_results_that_are_still_better_than_top1_subject,88 best_10_subject_results]:89 for ir in top_10_results:...
cem.py
Source:cem.py
...76 # generate new pop77 self.generate_pop()78 self.sync_pop_weights()79 @override(NeuroEvolution)80 def get_iteration_results(self):81 data = super().get_iteration_results()82 data.update({83 "fitness": self.fitnesses,84 "var_noise": self.noise,85 "pop_var_mean": np.mean(self.variance),86 "pop_var_max": np.max(self.variance),87 "pop_var_min": np.min(self.variance),88 "target_pop_l2_distance": np.linalg.norm(self.target_weights_flat-self.mean, ord=2)89 })...
check_learning_failures.py
Source:check_learning_failures.py
...14 result = dict(sorted(result.items(), key=lambda item: item[1], reverse=True))15 return result16def analyze(input_dirs):17 results: List[Results] = load_results(input_dirs)18 iteration_results: List[IterationResults] = get_iteration_results(results)19 iteration_results = sorted(iteration_results, key=lambda it_results: get_f1_sum_dev(it_results), reverse=True)20 failures = [ir for ir in iteration_results if is_failure(ir)]21 failures_by_experiment_name = count_experiments_distribution(failures,22 lambda ir: ir.experiment_name)23 failures_by_model_name = count_experiments_distribution(failures,24 lambda ir: get_model_name(ir.experiment_name))25 failures_by_wd = count_experiments_distribution(failures,26 lambda ir: get_wd(ir.experiment_name))27 failures_by_lr = count_experiments_distribution(failures,28 lambda ir: get_lr(ir.experiment_name))29 failures_by_lrwd = count_experiments_distribution(failures,30 lambda ir: get_lr(ir.experiment_name) + get_wd(31 ir.experiment_name))32 z = 1...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!