Best Python code snippet using assertpy_python
Main2.py
Source:Main2.py  
...74            f1_micro[algorithm + '_wrapper'] = np.zeros((9, 10))75            train_time[algorithm + '_wrapper'] = np.zeros((9, 10))76            test_time[algorithm + '_wrapper'] = np.zeros((9, 10))77            for percent in range(1, 10):78                a, b, c, d, e = wrapper.cross_validation_wrapper(79                    data_name=data_set_name, mlc_type=mlc, compare_with=algorithm, feature_threshold=(percent * 0.1),80                    need_normalize=need_normalize, need_sampling=need_sampling, need_contaminate=need_contaminate)81                hamming_loss[algorithm + '_wrapper'][percent-1, :], f1_macro[algorithm + '_wrapper'][percent-1, :],\82                f1_micro[algorithm + '_wrapper'][percent-1, :], train_time[algorithm + '_wrapper'][percent-1, :],\83                test_time[algorithm + '_wrapper'][percent-1, :] = a[percent-1, :], b[percent-1, :], c[percent-1, :],\84                                                                  d[percent-1, :], e[percent-1, :]85            np.save(dir_name + '/hamming_loss_' + algorithm + '_wrapper', hamming_loss[algorithm + '_wrapper'])86            np.save(dir_name + '/f1_macro_' + algorithm + '_wrapper', f1_macro[algorithm + '_wrapper'])87            np.save(dir_name + '/f1_micro_' + algorithm + '_wrapper', f1_micro[algorithm + '_wrapper'])88            np.save(dir_name + '/train_time_' + algorithm + '_wrapper', train_time[algorithm + '_wrapper'])89            np.save(dir_name + '/test_time_' + algorithm + '_wrapper', test_time[algorithm + '_wrapper'])90        else:91            ranking_loss[algorithm + '_wrapper'] = np.zeros((9, 10))92            average_precision[algorithm + '_wrapper'] = np.zeros((9, 10))93            train_time[algorithm + '_wrapper'] = np.zeros((9, 10))94            test_time[algorithm + '_wrapper'] = np.zeros((9, 10))95            for percent in range(1, 10):96                a, b, c, d = wrapper.cross_validation_wrapper(97                    data_name=data_set_name, mlc_type=mlc, compare_with=algorithm, feature_threshold=(percent * 0.1),98                    need_normalize=need_normalize, need_sampling=need_sampling, need_contaminate=need_contaminate)99                ranking_loss[algorithm + '_wrapper'][percent-1, :],\100                average_precision[algorithm + '_wrapper'][percent-1, :],\101                train_time[algorithm + '_wrapper'][percent-1, :],\102                test_time[algorithm + '_wrapper'][percent-1, :] = a[percent-1, :], b[percent-1, :], c[percent-1, :],\103                                                                  d[percent-1, :]104            np.save(dir_name + '/ranking_loss_' + algorithm + '_wrapper', ranking_loss[algorithm + '_wrapper'])105            np.save(dir_name + '/average_precision_' + algorithm + '_wrapper', average_precision[algorithm + '_wrapper'])106            np.save(dir_name + '/train_time_' + algorithm + '_wrapper', train_time[algorithm + '_wrapper'])107            np.save(dir_name + '/test_time_' + algorithm + '_wrapper', test_time[algorithm + '_wrapper'])108    return load_results(data_set_name, mlc, test_name, algorithm_list_filter, algorithm_list_wrapper)109    #  return hamming_loss, f1_macro, f1_micro, ranking_loss, average_precision, train_time, test_time110def load_results(data_set_name, mlc, test_name, algorithm_list_filter=[], algorithm_list_wrapper=[]):...Main.py
Source:Main.py  
...72            np.save(dir_name + '/test_time_' + algorithm, test_time[algorithm])73    for algorithm in algorithm_list_wrapper:74        if mlc != 'CLR':75            hamming_loss[algorithm + '_wrapper'], f1_macro[algorithm + '_wrapper'], f1_micro[algorithm + '_wrapper'],\76             train_time[algorithm + '_wrapper'], test_time[algorithm + '_wrapper'] = wrapper.cross_validation_wrapper(77                    data_name=data_set_name, mlc_type=mlc, compare_with=algorithm, feature_threshold=0,78                    need_normalize=need_normalize, need_sampling=need_sampling, need_contaminate=need_contaminate,79                    need_shuffling=need_shuffling)80            np.save(dir_name + '/hamming_loss_' + algorithm + '_wrapper', hamming_loss[algorithm + '_wrapper'])81            np.save(dir_name + '/f1_macro_' + algorithm + '_wrapper', f1_macro[algorithm + '_wrapper'])82            np.save(dir_name + '/f1_micro_' + algorithm + '_wrapper', f1_micro[algorithm + '_wrapper'])83            np.save(dir_name + '/train_time_' + algorithm + '_wrapper', train_time[algorithm + '_wrapper'])84            np.save(dir_name + '/test_time_' + algorithm + '_wrapper', test_time[algorithm + '_wrapper'])85        else:86            ranking_loss[algorithm + '_wrapper'], average_precision[algorithm + '_wrapper'], \87             train_time[algorithm + '_wrapper'], test_time[algorithm + '_wrapper'] =\88             wrapper.cross_validation_wrapper(89                    data_name=data_set_name, mlc_type=mlc, compare_with=algorithm, feature_threshold=0,90                    need_normalize=need_normalize, need_sampling=need_sampling, need_contaminate=need_contaminate,91                    need_shuffling=need_shuffling)92            np.save(dir_name + '/ranking_loss_' + algorithm + '_wrapper', ranking_loss[algorithm + '_wrapper'])93            np.save(dir_name + '/average_precision_' + algorithm + '_wrapper', average_precision[algorithm + '_wrapper'])94            np.save(dir_name + '/train_time_' + algorithm + '_wrapper', train_time[algorithm + '_wrapper'])95            np.save(dir_name + '/test_time_' + algorithm + '_wrapper', test_time[algorithm + '_wrapper'])96    return load_results(data_set_name, mlc, test_name, algorithm_list_filter, algorithm_list_wrapper )97    #  return hamming_loss, f1_macro, f1_micro, ranking_loss, average_precision, train_time, test_time98def load_results(data_set_name, mlc, test_name, algorithm_list_filter=[], algorithm_list_wrapper=[]):99    # loading results from test() and show the plot100    hamming_loss = dict()101    f1_macro = dict()102    f1_micro = dict()...yaxmlplus.py
Source:yaxmlplus.py  
...126            for image in images:127                etree.SubElement(offer, "image").text = image            128        etree.SubElement(offer, "description").text = self._wrapper.description()129        if not is_stead:130            self.unit_wrapper(etree, etree.SubElement(offer, "area"), self._wrapper.area())131            if self._wrapper.living_space():132                self.unit_wrapper(etree, etree.SubElement(offer, "living-space"), self._wrapper.living_space())133            if self._wrapper.kitchen_space():134                self.unit_wrapper(etree, etree.SubElement(offer, "kitchen-space"), self._wrapper.kitchen_space())135            for room_space in self._wrapper.rooms_space():136                self.unit_wrapper(etree, etree.SubElement(offer, "room-space"), room_space)137            if self._wrapper.rooms_type():138                etree.SubElement(offer, "rooms-type").text = self._wrapper.rooms_type()            139            self.add_bool_element(etree, offer, 'kitchen-furniture', self._wrapper.kitchen_furniture())140            self.add_bool_element(etree, offer, 'room-furniture', self._wrapper.room_furniture())141            self.add_bool_element(etree, offer, 'television', self._wrapper.television())142            self.add_bool_element(etree, offer, 'washing-machine', self._wrapper.washing_machine())143            self.add_bool_element(etree, offer, 'refrigerator', self._wrapper.refrigerator())144            self.add_bool_element(etree, offer, 'alarm', self._wrapper.alarm())145        else:146            etree.SubElement(offer, "lot-type").text = self._wrapper.lot_type()            147        if has_stead: 148            self.unit_wrapper(etree, etree.SubElement(offer, "lot-area"), self._wrapper.lot_area(), u'ÑоÑ')149        self.add_bool_element(etree, offer, 'new-flat', self._wrapper.new_flat())     150        if self._wrapper.rooms():151            etree.SubElement(offer, "rooms").text = self._wrapper.rooms()        152        if self._wrapper.rooms_offered():153            etree.SubElement(offer, "rooms-offered").text = self._wrapper.rooms_offered()154        155        if self._wrapper.is_studio():156            self.add_bool_element(etree, offer, 'open-plan', self._wrapper.is_studio())157                        158        self.add_bool_element(etree, offer, 'phone', self._wrapper.phone())        159        self.add_bool_element(etree, offer, 'internet', self._wrapper.internet())160        self.add_bool_element(etree, offer, 'mortgage', self._wrapper.mortgage())161        162        if self._wrapper.renovation():...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!!
