I am trying to use Automated Recommendation Tool which utilizes pymc3 package but I am facing issues while executing the following code cell -
%%time
if run_art:
art = RecommendationEngine(df, **art_params)
else:
with open(os.path.join(art_params['output_directory'], 'art.pkl'), 'rb') as output:
art = pickle.load(output)
Following is the error that pops up -
ValueError Traceback (most recent call last)
File <timed exec>:2, in <module>
File ~/MyDrive/BII/AutomatedRecommendationTool/art/core.py:409, in RecommendationEngine.__init__(self, df, input_vars, input_var_type, bounds_file, scale_input_vars, response_vars, build_model, cross_val, ensemble_model, standardize, intercept, recommend, objective, threshold, target_values, num_recommendations, rel_rec_distance, niter, alpha, output_directory, max_mcmc_cores, verbose, testing, seed, initial_cycle, warning_callback, last_dashes_denote_replicates, num_sklearn_models, num_tpot_models)
407 self.save_pkl_object()
408 elif build_model:
--> 409 self.build_model()
410 if recommend:
411 self.optimize()
File ~/MyDrive/BII/AutomatedRecommendationTool/art/core.py:612, in RecommendationEngine.build_model(self)
609 self._initialize_models()
611 if self.cross_val:
--> 612 self._cross_val_models()
613 plot.predictions_vs_observations(self, cv_flag=True, errorbars_flag=True)
615 self._fit_models()
File ~/MyDrive/BII/AutomatedRecommendationTool/art/core.py:1063, in RecommendationEngine._cross_val_models(self)
1056 cv_predictions[j][i] = level0_cv_predictions
1058 # ================================================== #
1059 # Cross validated predictions for the ensemble model
1060 # -------------------------------------------------- #
1061
1062 # Build (fit) ensemble model
-> 1063 self._build_ensemble_model(idx=train_idx)
1065 # Predictions with ensemble model
1066 # Apart from the mean values, store prediction std and draws for plotting
1067 # (not possible always due to a bug in pymc3)
1068 f = np.zeros((len(test_idx), self.num_models, self.num_response_var))
File ~/MyDrive/BII/AutomatedRecommendationTool/art/core.py:989, in RecommendationEngine._build_ensemble_model(self, idx)
986 if self.standardize:
987 self._standardize_level1_data()
--> 989 self._ensemble_model(idx)
File ~/MyDrive/BII/AutomatedRecommendationTool/art/core.py:1428, in RecommendationEngine._ensemble_model(self, idx, testing)
1418 if not testing:
1419 # Instantiate sampler and draw samples from the posterior.
1420 # Omit the random_seed parameter, since PYMC3 @3.8 internally calls
(...)
1425 # chains. That should still be predictable since ART calls np.random.seed()
1426 # above.
1427 step = pm.NUTS() # Slice, Metropolis, HamiltonianMC, NUTS
-> 1428 self.trace[j] = pm.sample(
1429 const.n_iterations,
1430 step=step,
1431 initvals=initvals,
1432 progressbar=progressbar,
1433 tune=const.tune_steps,
1434 cores=cores,
1435 # work around an API update to be added in PYMC3 4.0
1436 return_inferencedata=False,
1437 # , init=adapt_diag
1438 # live_plot=True, skip_first=100, refresh_every=300, roll_over=1000
1439 )
1441 logger = logging.getLogger("pymc3")
1442 logger.propagate = True
File ~/anaconda3/lib/python3.9/site-packages/pymc3/sampling.py:515, in sample(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, progressbar, model, random_seed, discard_tuned_samples, compute_convergence_checks, callback, jitter_max_retries, return_inferencedata, idata_kwargs, mp_ctx, pickle_backend, **kwargs)
513 step = assign_step_methods(model, step, step_kwargs=kwargs)
514 else:
--> 515 step = assign_step_methods(model, step, step_kwargs=kwargs)
517 if isinstance(step, list):
518 step = CompoundStep(step)
File ~/anaconda3/lib/python3.9/site-packages/pymc3/sampling.py:217, in assign_step_methods(model, step, methods, step_kwargs)
209 selected = max(
210 methods,
211 key=lambda method, var=var, has_gradient=has_gradient: method._competence(
212 var, has_gradient
213 ),
214 )
215 selected_steps[selected].append(var)
--> 217 return instantiate_steppers(model, steps, selected_steps, step_kwargs)
File ~/anaconda3/lib/python3.9/site-packages/pymc3/sampling.py:143, in instantiate_steppers(_model, steps, selected_steps, step_kwargs)
141 unused_args = set(step_kwargs).difference(used_keys)
142 if unused_args:
--> 143 raise ValueError("Unused step method arguments: %s" % unused_args)
145 if len(steps) == 1:
146 return steps[0]
ValueError: Unused step method arguments: {'initvals'}
I am using Ubuntu as OS and I have already installed a C++ compiler.
Anybody who has faced similar issue and has been able to solve it, please help me out.