[BUG] Issue with the CAM algorithm
Hello again,
I'm working with the CAM algorithm. obj = CAM() output = obj.predict(data[variables]) Running this code it's working well for some data but for others I have the following issue.
R Python Error Output
[Errno 2] File C:\Users\UT\AppData\Local\Temp\cdt_cam_5dc94ac3-aed2-48f9-bf5a-a63b497b0ac4\result.csv does not exist: 'C:\Users\UT\AppData\Local\Temp\cdt_cam_5dc94ac3-aed2-48f9-bf5a-a63b497b0ac4\result.csv'
RuntimeError Traceback (most recent call last)
~\anaconda3\lib\site-packages\cdt\causality\graph\model.py in predict(self, df_data, graph, **kwargs) 61 """ 62 if graph is None: ---> 63 return self.create_graph_from_data(df_data, **kwargs) 64 elif isinstance(graph, nx.DiGraph): 65 return self.orient_directed_graph(df_data, graph, **kwargs)
~\anaconda3\lib\site-packages\cdt\causality\graph\CAM.py in create_graph_from_data(self, data, **kwargs) 180 self.arguments['{NJOBS}'] = str(self.njobs) 181 self.arguments['{VERBOSE}'] = str(self.verbose).upper() --> 182 results = self._run_cam(data, verbose=self.verbose) 183 184 return nx.relabel_nodes(nx.DiGraph(results),
~\anaconda3\lib\site-packages\cdt\causality\graph\CAM.py in _run_cam(self, data, fixedGaps, verbose) 204 except Exception as e: 205 rmtree(run_dir) --> 206 raise e 207 except KeyboardInterrupt: 208 rmtree(run_dir)
~\anaconda3\lib\site-packages\cdt\causality\graph\CAM.py in _run_cam(self, data, fixedGaps, verbose) 200 data.to_csv(Path('{}/data.csv'.format(run_dir)), header=False, index=False) 201 cam_result = launch_R_script(Path("{}/R_templates/cam.R".format(os.path.dirname(os.path.realpath(file)))), --> 202 self.arguments, output_function=retrieve_result, verbose=verbose) 203 # Cleanup 204 except Exception as e:
~\anaconda3\lib\site-packages\cdt\utils\R.py in launch_R_script(template, arguments, output_function, verbose, debug) 220 print("\nR Python Error Output \n-----------------------\n") 221 print(e) --> 222 raise RuntimeError("RProcessError \nR Process Error Output \n-----------------------\n" + str(err, "ISO-8859-1")) from None 223 print("\nR Python Error Output \n-----------------------\n") 224 print(e)
RuntimeError: RProcessError R Process Error Output
Le chargement a nécessité le package : glmnet Le chargement a nécessité le package : Matrix Loaded glmnet 4.0-2 Le chargement a nécessité le package : mboost Le chargement a nécessité le package : parallel Le chargement a nécessité le package : stabs This is mboost 2.9-2. See 'package?mboost' and 'news(package = "mboost")' for a complete list of changes.
Attachement du package : 'mboost'
The following object is masked from 'package:glmnet':
Cindex
Le chargement a nécessité le package : mgcv Le chargement a nécessité le package : nlme This is mgcv 1.8-31. For overview type 'help("mgcv-package")'. Warning message: replacing previous import 'glmnet::Cindex' by 'mboost::Cindex' when loading 'CAM' Error in knotf(mf[[n]], if (is.list(knots)) knots[[n]] else knots, if (is.list(boundary.knots)) boundary.knots[[n]] else boundary.knots) : boundary.knots must be a vector (or a list of vectors) of length 2 in increasing order Calls: CAM ... lapply -> FUN -> bl_lin -> newX -> hyper_bbs -> knotf Exécution arrêtée
Thanks in advance for your help !
Hello, it might because of the type of the input data ; is it only continuous variables ? or are there discrete variables in your data as well ?
CAM is made exclusively (at least this implementation) for numerical data. Your error comes from the regressor of the model that does not converge.
Hello,
Thanks for your answer ! It's only continuous variables, it's working when I remove one of the variables regardless of which one, that's weird.