GithubHelp home page GithubHelp logo

Comments (7)

mateoespinosa avatar mateoespinosa commented on July 30, 2024

Hey! Are you running with a specific issue? If you send your problem here, I may be able to help by taking a look at it. Thanks!

from remix.

garydh avatar garydh commented on July 30, 2024

I was trying to run it in google colab and I'm having this error when I tried to run from remix import eclaire
I have installed all the R packages, does anyone know how to fix it? :(

NotImplementedError                       Traceback (most recent call last)

[<ipython-input-6-4868eb65e563>](https://localhost:8080/#) in <module>
      3 pandas2ri.activate()
      4 
----> 5 from remix import eclaire # Or rem_d, pedagogical, rem_t, deep_red_c5
      6 # ruleset = eclaire.extract_rules(train, X_train)
      7 # print(ruleset)

8 frames

[/content/remix/__init__.py](https://localhost:8080/#) in <module>
      5 from remix.visualization import *
      6 
----> 7 import remix.extract_rules.pedagogical as pedagogical
      8 import remix.extract_rules.rem_t as rem_t
      9 import remix.extract_rules.rem_d as rem_d

[/content/remix/extract_rules/pedagogical.py](https://localhost:8080/#) in <module>
     10 
     11 from remix.logic_manipulator.merge import merge
---> 12 from remix.rules.C5 import C5
     13 from remix.rules.cart import cart_rules, random_forest_rules
     14 from remix.rules.ruleset import Ruleset

[/content/remix/rules/C5.py](https://localhost:8080/#) in <module>
     18 
     19 # C50 R package is interface to C5.0 classification model
---> 20 C50 = importr('C50')
     21 C5_0 = robjects.r('C5.0')
     22 

[/usr/local/lib/python3.8/dist-packages/rpy2/robjects/packages.py](https://localhost:8080/#) in importr(name, lib_loc, robject_translations, signature_translation, suppress_messages, on_conflict, symbol_r2python, symbol_resolve, data)
    494     pack: typing.Union[InstalledSTPackage, InstalledPackage]
    495     if signature_translation:
--> 496         pack = InstalledSTPackage(env, name,
    497                                   translation=robject_translations,
    498                                   exported_names=exported_names,

[/usr/local/lib/python3.8/dist-packages/rpy2/robjects/packages.py](https://localhost:8080/#) in __init__(self, env, name, translation, exported_names, on_conflict, version, symbol_r2python, symbol_resolve)
    201         self._symbol_r2python = symbol_r2python
    202         self._symbol_resolve = symbol_resolve
--> 203         self.__fill_rpy2r__(on_conflict=on_conflict)
    204         self._exported_names = self._exported_names.difference(mynames)
    205         self.__version__ = version

[/usr/local/lib/python3.8/dist-packages/rpy2/robjects/packages.py](https://localhost:8080/#) in __fill_rpy2r__(self, on_conflict)
    327 
    328     def __fill_rpy2r__(self, on_conflict='fail'):
--> 329         (super(SignatureTranslatedPackage, self)
    330          .__fill_rpy2r__(on_conflict=on_conflict))
    331         for name, robj in self.__dict__.items():

[/usr/local/lib/python3.8/dist-packages/rpy2/robjects/packages.py](https://localhost:8080/#) in __fill_rpy2r__(self, on_conflict)
    262             except rinterface.embedded.RRuntimeError as rre:
    263                 warn(str(rre))
--> 264             rpyobj = cv.rpy2py(riobj)
    265             if hasattr(rpyobj, '__rname__'):
    266                 rpyobj.__rname__ = rname

[/usr/lib/python3.8/functools.py](https://localhost:8080/#) in wrapper(*args, **kw)
    873                             '1 positional argument')
    874 
--> 875         return dispatch(args[0].__class__)(*args, **kw)
    876 
    877     funcname = getattr(func, '__name__', 'singledispatch function')

[/usr/local/lib/python3.8/dist-packages/rpy2/robjects/conversion.py](https://localhost:8080/#) in _rpy2py(obj)
    250     non-rpy2) objects.
    251     """
--> 252     raise NotImplementedError(
    253         "Conversion 'rpy2py' not defined for objects of type '%s'" %
    254         str(type(obj))

NotImplementedError: Conversion 'rpy2py' not defined for objects of type '<class 'rpy2.rinterface_lib.sexp.SexpEnvironment'>'

from remix.

zoevas avatar zoevas commented on July 30, 2024

I have the same issue, in windows I added R_HOME to the environment variables and to the PATH
Capture
and I get error

Traceback (most recent call last):
  File "D:\zoesem\PHD\implementations\Activations\HeartModelKeras.py", line 188, in <module>
    from remix import eclaire
  File "D:\zoesem\PHD\implementations\Activations\remix\__init__.py", line 7, in <module>
    import remix.extract_rules.pedagogical as pedagogical
  File "D:\zoesem\PHD\implementations\Activations\remix\extract_rules\pedagogical.py", line 12, in <module>
    from remix.rules.C5 import C5

from remix.

mateoespinosa avatar mateoespinosa commented on July 30, 2024

Hi @garydh and @zoevas, I apologise for the delay; I missed these replies! Below I reply to both comments above:

  • @garydh unfortunately I don't think I can help much here with understanding why this doesn't work within a Google Colab notebook (sorry!). The dependencies between this project and rpy2py are unfortunately necessary as the official C5.0 is implemented in R. If the interaction between rpy2py and R's C5.0 is the issue, then I am afraid this goes beyond my comfort technical zone (as it is a technical issue on libraries I did not write). However, you may find better advice on the official rpy2py site.
    As a quick note, I would say that Colab has a very particular rigid setup (for clear security reasons) and is not very customisable, hence I would not be surprised if a lot of twisting is required to get rpy2py working in Colab. If possible, I would recommend running this library within a fully customisable environment where you can make sure the correct R libraries are installed and that rpy2py is correctly interacting with these libraries.

  • @zoevas I am not too familiar with a Windows setup, so I may not be able to help with this :(. However, could you please send the entire error trace in case something I am familiar with pops up? I believe the trace you sent above is missing the part showing which exception/error was thrown.
    As in my comment above, however, I would appreciate it if you first discard that the error is not on your R and rpy2py setups. You can check this by testing if you can import C5 from R as I have done here. These libraries are outside my control and are an important dependency of this project. So if they are not correctly set up, or you hit an issue there, then their respective project sites may be a better source for help than myself. Apologies for this in advance (I promise that if I could get rid of this dependency, I would...)

As reference to the original title of this ticket, I am aware that other works have been able to use this library successfully (as seen by these papers [1, 2, 3]). However, I am aware that it is not the easiest library to setup/interact with due to its weird dependencies, so I am sorry about that!

from remix.

zoevas avatar zoevas commented on July 30, 2024

Dear @mateoespinosa ,

Thank you very much for the analytical response. Especially, the papers you attached are very useful, as I try to use a rule-based approach for explanations.

Finally, on Linux, it worked with R, and in Windows, I added the R_HOME to be C:\Program Files\R\R4.3 , and it worked. Namely, I removed the bin/x64 from the R_HOME as shown in the above images I had attached.

I would like to ask about the output of the program, I get this output: IF (1.0000 | 1.0000)[] THEN 0
Is this an expected output? I am just asking since I thought that input feature names would be included in the explanation such as If (feature_x1 > 0.5) THEN 0

from remix.

mateoespinosa avatar mateoespinosa commented on July 30, 2024

Hi @zoevas! Thanks for getting back to me so quickly. I am happy you got it working in Windows!

As for your recent question, I may need a bit more context for me to be able to help debuging this. What seems to be happening is that ECLAIRE/C5.0 is extracting a trivial rule (a rule whose antecedent is always "true") and always outputting 0 as a class regardless of the input features (hence the highly confident rule without any clauses inside it). This could be because of poor hyperparameterisation of the rule extractor, because of a faulty model, or because the model's architecture does not comply with what ECLAIRE expects. If you post some more details on the architecture and extraction pipeline here, I may be able to help tho. In the meantime, do make sure to look at the different arguments of ECLAIRE here as it could be the case that, say, your model is not outputting a valid probability distribution (i.e., it is outputting logits) and therefore you need to specify an activation function via the last_activation argument.

from remix.

mateoespinosa avatar mateoespinosa commented on July 30, 2024

Hey everyone!

Given the staleness of this ticket, I will close it for now. However, if you encounter any other specific issues/problems with this library, please feel free to reopen this ticket or create a new one with your specific issue (including details and reproducibility steps if possible, as those are hugely helpful!). Thank you so much!

from remix.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.