How to use _prepare_data method in autotest

Best Python code snippet using autotest_python

statics.py

Source:statics.py Github

copy

Full Screen

...126 Returns127 -------128 return a dict of result mean.129 """130 return self._prepare_data(cols_dict, "mean")131 def get_median(self, cols_dict=None):132 medians = {}133 if cols_dict is None:134 cols_dict = self.cols_dict135 if self.medians is None:136 self.medians = self._get_quantile_median()137 for col_name in cols_dict:138 if col_name not in self.medians:139 LOGGER.warning("The column {}, has not set in selection parameters."140 "median values is not available".format(col_name))141 continue142 medians[col_name] = self.medians[col_name]143 return medians144 def _get_quantile_median(self):145 bin_param = FeatureBinningParam(bin_num=2, cols=self.cols)146 binning_obj = QuantileBinning(bin_param)147 split_points = binning_obj.fit_split_points(self.data_instances)148 medians = {}149 for col_name, split_point in split_points.items():150 medians[col_name] = split_point[0]151 return medians152 def get_variance(self, cols_dict=None):153 return self._prepare_data(cols_dict, "variance")154 def get_std_variance(self, cols_dict=None):155 return self._prepare_data(cols_dict, "std_variance")156 def get_max(self, cols_dict=None):157 return self._prepare_data(cols_dict, "max_value")158 def get_min(self, cols_dict=None):159 return self._prepare_data(cols_dict, "min_value")160 def _prepare_data(self, cols_dict, data_type):161 """162 Return the specific static value(s) of the given column163 Parameters164 ----------165 cols_dict : dict166 Specify which column(s) need to apply statistic.167 data_type : str, "mean", "variance", "std_variance", "max_value" or "mim_value"168 Specify which type to show.169 Returns170 -------171 return a list of result result. The order is the same as cols.172 """173 if not self.finish_fit:174 self._static_sums()...

Full Screen

Full Screen

datasets.py

Source:datasets.py Github

copy

Full Screen

...6 records, labels = physionet.read_challenge17_data(db_dir, verbose=verbose)7 if normalize:8 normalize = functools.partial(9 physionet.normalize_challenge17, inplace=True)10 data_set = _prepare_data(11 records,12 labels,13 normalize_fn=normalize,14 fs=fs,15 pad=pad,16 verbose=verbose)17 return data_set18def get_challenge20_data(db_dir, fs=None, pad=None, normalize=False, verbose=False):19 records, labels = physionet.read_challenge20_data(db_dir, verbose=verbose)20 if normalize:21 normalize = functools.partial(22 physionet.normalize_challenge20, inplace=True)23 data_set = _prepare_data(24 records,25 labels,26 normalize_fn=normalize,27 fs=fs,28 pad=pad,29 verbose=verbose)30 return data_set31def get_ptb_xl_data(db_dir, fs=None, pad=None, normalize=False,32 category='rhythm', folds=None, verbose=False):33 records, labels = physionet.read_ptb_xl_data(34 db_dir=db_dir,35 fs='hr',36 category=category,37 remove_empty=True,38 folds=folds,39 verbose=verbose)40 if normalize:41 normalize = functools.partial(42 physionet.normalize_ptb_xl, inplace=True)43 data_set = _prepare_data(44 records,45 labels,46 normalize_fn=normalize,47 fs=fs,48 pad=pad,49 verbose=verbose)50 return data_set51def _prepare_data(records, labels, normalize_fn=None, fs=None, pad=None, verbose=False):52 x = _transform_records(53 records,54 fs=fs,55 pad=pad,56 normalize=normalize_fn,57 verbose=verbose)58 data_set = {'x': x,59 'y': labels.to_numpy(),60 'record_ids': labels.index.to_numpy(),61 'classes': labels.columns.to_numpy()}62 return data_set63def _transform_records(records, fs=None, pad=None, normalize=None, verbose=False):64 if not normalize:65 def normalize(signal): return signal...

Full Screen

Full Screen

test_team_members_filters.py

Source:test_team_members_filters.py Github

copy

Full Screen

...7 """8 Test filter by role developer.9 :param user:10 """11 _prepare_data()12 queryset = TeamMembersFilterSet(13 data={KEY_ROLES: "DEVELOPER"},14 queryset=TeamMember.objects.all(),15 ).qs16 assert queryset.count() == 217def test_filter_by_role_leader(user):18 """19 Test filter by role leader.20 :param user:21 """22 _prepare_data()23 queryset = TeamMembersFilterSet(24 data={KEY_ROLES: "LEADER"},25 queryset=TeamMember.objects.all(),26 ).qs27 assert queryset.count() == 128def test_filter_by_role_watcher(user):29 """30 Test filter by role watcher.31 :param user:32 """33 _prepare_data()34 queryset = TeamMembersFilterSet(35 data={KEY_ROLES: "WATCHER"},36 queryset=TeamMember.objects.all(),37 ).qs38 assert queryset.count() == 139def test_filter_by_incorrect_role(user):40 """41 Test filter by incorrect role.42 :param user:43 """44 _prepare_data()45 queryset = TeamMembersFilterSet(46 data={KEY_ROLES: "incorrect value"},47 queryset=TeamMember.objects.all(),48 ).qs49 assert queryset.count() == 450def test_filter_by_none_role(user):51 """52 Test filter by none role.53 :param user:54 """55 _prepare_data()56 queryset = TeamMembersFilterSet(57 data={KEY_ROLES: None},58 queryset=TeamMember.objects.all(),59 ).qs60 assert queryset.count() == 461def _prepare_data():62 """Prepare data."""63 users = UserFactory.create_batch(2)64 teams = TeamFactory.create_batch(2)65 TeamMemberFactory.create(66 user=users[0],67 team=teams[0],68 roles=TeamMember.roles.LEADER,69 )70 TeamMemberFactory.create(71 user=users[1],72 team=teams[0],73 roles=TeamMember.roles.DEVELOPER,74 )75 TeamMemberFactory.create(...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful