GithubHelp home page GithubHelp logo

would you like to provide this json file ('../../json/sklearn_randomforest_keck_pria_only.json') for your test.ipynb about pria_lifechem HOT 13 CLOSED

xuzhang5788 avatar xuzhang5788 commented on July 19, 2024
would you like to provide this json file ('../../json/sklearn_randomforest_keck_pria_only.json') for your test.ipynb

from pria_lifechem.

Comments (13)

chao1224 avatar chao1224 commented on July 19, 2024

Hi @xuzhang5788, can you try replace ../../json/sklearn_randomforest_keck_pria_only.json with ../../json/sklearn_randomforest.json? Does that work for you?

from pria_lifechem.

xuzhang5788 avatar xuzhang5788 commented on July 19, 2024

@chao1224
Sorry, No.
When I run cell 3, I got

process id: 0
Testing set: {'class_weight': 'balanced', 'max_features': 'log2', 'min_samples_leaf': 1, 'n_estimators': 4000}


KeyError Traceback (most recent call last)
in ()
----> 1 task = SKLearn_RandomForest(conf=conf)

in init(self, conf)
61
62 self.model_dict = {}
---> 63 self.useVal = bool(conf['useVal'])
64 return
65

KeyError: 'useVal'

from pria_lifechem.

chao1224 avatar chao1224 commented on July 19, 2024

@xuzhang5788 I see. Can you try one more thing?
Replace self.useVal = bool(conf['useVal']) with self.useVal = False.

Sry this is using an old env, and I don't have it on my server right now. I can recreate it if things don't work out.

from pria_lifechem.

xuzhang5788 avatar xuzhang5788 commented on July 19, 2024

@chao1224
Sorry. It still doesn't work.

process id: 0
Testing set: {'class_weight': 'balanced', 'max_features': 'log2', 'min_samples_leaf': 1, 'n_estimators': 4000}


AttributeError Traceback (most recent call last)
in ()
----> 1 task = SKLearn_RandomForest(conf=conf)

in init(self, conf)
62 self.model_dict = {}
63 #self.useVal = bool(conf['useVal'])
---> 64 self.useVal = False
65 return
66

AttributeError: can't set attribute

from pria_lifechem.

chao1224 avatar chao1224 commented on July 19, 2024

@xuzhang5788 I'm not sure if you are using the same conda env.

I tried to reinstall everything (codes, dataset, and conda env). The notebook has been updated.

from pria_lifechem.

xuzhang5788 avatar xuzhang5788 commented on July 19, 2024

@chao1224
Thank you for your response. I retried it, but I still had the same error message. My python is python3. I have changed your .py files into python3 files.

from pria_lifechem.

chao1224 avatar chao1224 commented on July 19, 2024

@xuzhang5788 Then I think it should be the anaconda environment(like python version) issue. To make sure the results are reproducible, I personally would recommend you try the same environment.

from pria_lifechem.

agitter avatar agitter commented on July 19, 2024

@xuzhang5788 I was thinking the same thing as @chao1224. Are you running inside the exact same conda environment that we describe here? It is not enough to use Python 3. We have seen that the APIs for some of the major packages can change so it is necessary to lock the version of those packages in order to rerun our code.

from pria_lifechem.

agitter avatar agitter commented on July 19, 2024

@xuzhang5788 were you able to get this working inside the conda environment? Please let us know if you need additional help or if we should close this issue.

from pria_lifechem.

xuzhang5788 avatar xuzhang5788 commented on July 19, 2024

@agitter
Thank you so much for your reply. Today I followed your instruction and set conda environment using
conda env create -f conda_env.yml python=2.7
and also changed my jupyter notebook setting with python2. When I run test.ipynb, I still got error messages like this:
in the first cell:
LookupError Traceback (most recent call last)
in ()
7 sys.path.insert(0, '..') # Add path from parent folder
8 sys.path.insert(0, '.') # Add path from current folder
----> 9 from evaluation import *
10 from function import *
11 from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor

/media/pharma1/projects/pria_lifechem/pria_lifechem/evaluation.py in ()
4 import numpy as np
5 from sklearn.metrics import roc_auc_score, average_precision_score, precision_recall_curve, roc_curve
----> 6 import rpy2.robjects as robjects
7 import rpy2.robjects.packages as rpackages
8 from sklearn.metrics import auc

/home/pharma1/anaconda3/envs/pria/lib/python2.7/site-packages/rpy2/robjects/init.py in ()
17 import rpy2.rlike.container as rlc
18
---> 19 from rpy2.robjects.robject import RObjectMixin, RObject
20 from rpy2.robjects.vectors import (BoolVector,
21 IntVector,

/home/pharma1/anaconda3/envs/pria/lib/python2.7/site-packages/rpy2/robjects/robject.py in ()
56 return rpy2type(rinterface_level)
57
---> 58 class RObjectMixin(object):
59 """ Class to provide methods common to all RObject instances """
60 rname = None

/home/pharma1/anaconda3/envs/pria/lib/python2.7/site-packages/rpy2/robjects/robject.py in RObjectMixin()
69 __rclass = rpy2.rinterface.baseenv.get("class")
70 __rclass_set = rpy2.rinterface.baseenv.get("class<-")
---> 71 __show = rpy2.rinterface.baseenv.get("show")
72
73 __slots = None

LookupError: 'show' not found

but when I use jupyter notebook with python3,
first two cells are working well, but the cell three showed
process id: 0
Testing set: {'class_weight': 'balanced', 'max_features': 'log2', 'min_samples_leaf': 1, 'n_estimators': 4000}


AttributeError Traceback (most recent call last)
in ()
----> 1 task = SKLearn_RandomForest(conf=conf)

in init(self, conf)
61
62 self.model_dict = {}
---> 63 self.useVal = False
64 return
65

AttributeError: can't set attribute

I don't know why.

from pria_lifechem.

Malnammi avatar Malnammi commented on July 19, 2024

@xuzhang5788 sorry for the late reply. I believe the issue is being caused by this part of the code:

    @property    
    def useVal(self):
        return self.useVal

Can you please try removing this and running it again in the python 3 environment?

from pria_lifechem.

xuzhang5788 avatar xuzhang5788 commented on July 19, 2024

@Malnammi
Thank you for your solution. It works.
I found there is a typo in def run on line 24
print (rain_index, val_index, test_index) should be print (train_index, val_index, test_index)
on line 18
it is better to use "test_index = int(running_index / 4)" to keep test_index as an integer. python3 will get a float if use "test_index = running_index / 4"
Thank you again

from pria_lifechem.

agitter avatar agitter commented on July 19, 2024

Thanks for finding this @Malnammi and the typo correction @xuzhang5788

@Malnammi should we make a pull request to fix this typo in the notebook?

from pria_lifechem.

Related Issues (4)

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.