-
Notifications
You must be signed in to change notification settings - Fork 2
SpecificationError: nested renamer is not supported #1
Description
I am getting the following error while running the sample notebook :
start = timer()
tree = cbdt.Contextual_Bandits_Tree(max_depth = 5).fit(train_df, click_column_name = 'click', option_column_name = 'option')
end = timer()
print('{} Seconds'.format(np.round(end - start,3)))
SpecificationError Traceback (most recent call last)
C.py in
1 start = timer()
----> 2 tree = cbdt.Contextual_Bandits_Tree(max_depth = 5).fit(train_df, click_column_name = 'click', option_column_name = 'option')
3 end = timer()
4 print('{} Seconds'.format(np.round(end - start,3)))
~\Desktop\Contextual_Bandits_Tree-master\Contextual_Bandits_Tree-master\Contextual_Bandits_Decision_Tree_Class.py in fit(self, data, click_column_name, option_column_name)
33
34 def fit(self, data, click_column_name = 'click', option_column_name = 'option'):
---> 35 self.tree = Node(data,
36 click_column_name = click_column_name,
37 option_column_name = option_column_name,
~\Desktop\Contextual_Bandits_Tree-master\Contextual_Bandits_Tree-master\Contextual_Bandits_Decision_Tree_Class.py in init(self, data, click_column_name, option_column_name, depth, max_depth, min_leaf_opens, min_leaf_clicks, max_p_value)
131 self.independent_variable_names = [x for x in data.columns if x not in [click_column_name, option_column_name]]
132 self.feature_types_dict = self.get_feature_types_dict()
--> 133 self.choice, self.incremental_clicks, self.p_value, self.pivot = self.get_node_info()
134 self.split_column = None
135 self.split_value = None
~\Desktop\Contextual_Bandits_Tree-master\Contextual_Bandits_Tree-master\Contextual_Bandits_Decision_Tree_Class.py in get_node_info(self)
182 def get_node_info(self):
183 '''Pivots data and extracts information from it'''
--> 184 pivot = self.data.groupby([self.option_column_name])[self.click_column_name].agg({opens= 'count', clicks= 'sum', mean='mean'})
185 sims = pivot.apply(lambda x: [np.random.beta(1 + x['clicks'],1+x['opens']) for i in range(1000)], axis=1)
186 pivot['prob_of_choice'] = pd.DataFrame(list(zip(*(sims.tolist()))), columns = sims.index).idxmax(axis = 1, skipna = True).value_counts()/1000
C:\Ancon\anaconda3\lib\site-packages\pandas\core\groupby\generic.py in aggregate(self, func, engine, engine_kwargs, *args, **kwargs)
247 # but not the class list / tuple itself.
248 func = maybe_mangle_lambdas(func)
--> 249 ret = self._aggregate_multiple_funcs(func)
250 if relabeling:
251 # error: Incompatible types in assignment (expression has type
C:\Ancon\anaconda3\lib\site-packages\pandas\core\groupby\generic.py in _aggregate_multiple_funcs(self, arg)
282 # have not shown a higher level one
283 # GH 15931
--> 284 raise SpecificationError("nested renamer is not supported")
285
286 elif any(isinstance(x, (tuple, list)) for x in arg):
SpecificationError: nested renamer is not supported