TypeError: '<' not supported between instances of 'NoneType' and 'int'Errors while installing NumPy for Python 3.6 on MacOS 10.10netmiko -> PAN OS - stops at config modeHow to Render Graph in Python using graphiz and anytree packagesDjango Error on edit in Django adminDjango celery 4 - ValueError: invalid literal for int() with base 10 when start celery workerasyncio in django viewHow can I use a list of lists, or a list of sets, for the TfidfVectorizer?Issue with adding a SimpleRNN or LSTM layer in Kerasfailing at downloading an image with “urllib.request.urlretrieve” in Pythonerror while importing keras ModuleNotFoundError: No module named 'tensorflow.examples'; 'tensorflow' is not a package

Source of the Wildfire?

How to redirect stdout to a file, and stdout+stderr to another one?

Why are BJTs common in output stages of power amplifiers?

Is there an academic word that means "to split hairs over"?

Can only the master initiate communication in SPI whereas in I2C the slave can also initiate the communication?

Was this seat-belt sign activation standard procedure?

Is this possible when it comes to the relations of P, NP, NP-Hard and NP-Complete?

Show solution to recurrence is never a square

"The van's really booking"

Will a coyote attack my dog on a leash while I'm on a hiking trail?

Can my Serbian girlfriend apply for a UK Standard Visitor visa and stay for the whole 6 months?

Were any toxic metals used in the International Space Station?

Is it wrong to omit object pronouns in these sentences?

Extract the characters before last colon

What is this old US Air Force plane?

Is there any way to adjust the damage type of the Eldritch Blast cantrip so that it does fire damage?

Why can't I share a one use code with anyone else?

Did galley captains put corks in the mouths of slave rowers to keep them quiet?

How to not get blinded by an attack at dawn

Why are solar panels kept tilted?

What was the ring Varys took off?

Was the dragon prowess intentionally downplayed in S08E04?

Are there any sonatas with only two sections?

How to disable Two-factor authentication for Apple ID?



TypeError: '


Errors while installing NumPy for Python 3.6 on MacOS 10.10netmiko -> PAN OS - stops at config modeHow to Render Graph in Python using graphiz and anytree packagesDjango Error on edit in Django adminDjango celery 4 - ValueError: invalid literal for int() with base 10 when start celery workerasyncio in django viewHow can I use a list of lists, or a list of sets, for the TfidfVectorizer?Issue with adding a SimpleRNN or LSTM layer in Kerasfailing at downloading an image with “urllib.request.urlretrieve” in Pythonerror while importing keras ModuleNotFoundError: No module named 'tensorflow.examples'; 'tensorflow' is not a package






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm trying to load a prediction after unpickling but I'm getting this error




/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/weight_boosting.py:29:
DeprecationWarning: numpy.core.umath_tests is an internal NumPy module
and should not be imported. It will be removed in a future NumPy
release. from numpy.core.umath_tests import inner1d
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/base.py:311:
UserWarning: Trying to unpickle estimator DecisionTreeClassifier from
version 0.20.2 when using version 0.19.2. This might lead to breaking
code or invalid results. Use at your own risk. UserWarning)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/base.py:311:
UserWarning: Trying to unpickle estimator RandomForestClassifier from
version 0.20.2 when using version 0.19.2. This might lead to breaking
code or invalid results. Use at your own risk. UserWarning)
Traceback (most recent call last): File "rf_pred_model_tester.py",
line 7, in
print('Class: ',int(rf.predict(xx))) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/forest.py",
line 538, in predict
proba = self.predict_proba(X) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/forest.py",
line 581, in predict_proba
n_jobs, _, _ = _partition_estimators(self.n_estimators, self.n_jobs) File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/base.py",
line 153, in _partition_estimators
n_jobs = min(_get_n_jobs(n_jobs), n_estimators) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/utils/init.py",
line 464, in _get_n_jobs
if n_jobs < 0: TypeError: '<' not supported between instances of 'NoneType' and 'int'




here is the code that i am trying to run



import pickle
import numpy as np
with open('rf_model_1','rb') as f:
rf=pickle.load(f)

xx = np.array([67, 17832, 1, 1, 0, 33, 1941902452, 36, 33011.0, 19, 18, 0, 2, 1]).reshape(1,-1)
print('Class: ',int(rf.predict(xx)))


I'm expecting a result like this :



Class: [0]


if i run the code on jupyter its working fine but, i'm getting error when i try to run on terminal.










share|improve this question






























    0















    I'm trying to load a prediction after unpickling but I'm getting this error




    /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/weight_boosting.py:29:
    DeprecationWarning: numpy.core.umath_tests is an internal NumPy module
    and should not be imported. It will be removed in a future NumPy
    release. from numpy.core.umath_tests import inner1d
    /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/base.py:311:
    UserWarning: Trying to unpickle estimator DecisionTreeClassifier from
    version 0.20.2 when using version 0.19.2. This might lead to breaking
    code or invalid results. Use at your own risk. UserWarning)
    /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/base.py:311:
    UserWarning: Trying to unpickle estimator RandomForestClassifier from
    version 0.20.2 when using version 0.19.2. This might lead to breaking
    code or invalid results. Use at your own risk. UserWarning)
    Traceback (most recent call last): File "rf_pred_model_tester.py",
    line 7, in
    print('Class: ',int(rf.predict(xx))) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/forest.py",
    line 538, in predict
    proba = self.predict_proba(X) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/forest.py",
    line 581, in predict_proba
    n_jobs, _, _ = _partition_estimators(self.n_estimators, self.n_jobs) File
    "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/base.py",
    line 153, in _partition_estimators
    n_jobs = min(_get_n_jobs(n_jobs), n_estimators) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/utils/init.py",
    line 464, in _get_n_jobs
    if n_jobs < 0: TypeError: '<' not supported between instances of 'NoneType' and 'int'




    here is the code that i am trying to run



    import pickle
    import numpy as np
    with open('rf_model_1','rb') as f:
    rf=pickle.load(f)

    xx = np.array([67, 17832, 1, 1, 0, 33, 1941902452, 36, 33011.0, 19, 18, 0, 2, 1]).reshape(1,-1)
    print('Class: ',int(rf.predict(xx)))


    I'm expecting a result like this :



    Class: [0]


    if i run the code on jupyter its working fine but, i'm getting error when i try to run on terminal.










    share|improve this question


























      0












      0








      0


      1






      I'm trying to load a prediction after unpickling but I'm getting this error




      /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/weight_boosting.py:29:
      DeprecationWarning: numpy.core.umath_tests is an internal NumPy module
      and should not be imported. It will be removed in a future NumPy
      release. from numpy.core.umath_tests import inner1d
      /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/base.py:311:
      UserWarning: Trying to unpickle estimator DecisionTreeClassifier from
      version 0.20.2 when using version 0.19.2. This might lead to breaking
      code or invalid results. Use at your own risk. UserWarning)
      /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/base.py:311:
      UserWarning: Trying to unpickle estimator RandomForestClassifier from
      version 0.20.2 when using version 0.19.2. This might lead to breaking
      code or invalid results. Use at your own risk. UserWarning)
      Traceback (most recent call last): File "rf_pred_model_tester.py",
      line 7, in
      print('Class: ',int(rf.predict(xx))) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/forest.py",
      line 538, in predict
      proba = self.predict_proba(X) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/forest.py",
      line 581, in predict_proba
      n_jobs, _, _ = _partition_estimators(self.n_estimators, self.n_jobs) File
      "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/base.py",
      line 153, in _partition_estimators
      n_jobs = min(_get_n_jobs(n_jobs), n_estimators) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/utils/init.py",
      line 464, in _get_n_jobs
      if n_jobs < 0: TypeError: '<' not supported between instances of 'NoneType' and 'int'




      here is the code that i am trying to run



      import pickle
      import numpy as np
      with open('rf_model_1','rb') as f:
      rf=pickle.load(f)

      xx = np.array([67, 17832, 1, 1, 0, 33, 1941902452, 36, 33011.0, 19, 18, 0, 2, 1]).reshape(1,-1)
      print('Class: ',int(rf.predict(xx)))


      I'm expecting a result like this :



      Class: [0]


      if i run the code on jupyter its working fine but, i'm getting error when i try to run on terminal.










      share|improve this question
















      I'm trying to load a prediction after unpickling but I'm getting this error




      /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/weight_boosting.py:29:
      DeprecationWarning: numpy.core.umath_tests is an internal NumPy module
      and should not be imported. It will be removed in a future NumPy
      release. from numpy.core.umath_tests import inner1d
      /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/base.py:311:
      UserWarning: Trying to unpickle estimator DecisionTreeClassifier from
      version 0.20.2 when using version 0.19.2. This might lead to breaking
      code or invalid results. Use at your own risk. UserWarning)
      /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/base.py:311:
      UserWarning: Trying to unpickle estimator RandomForestClassifier from
      version 0.20.2 when using version 0.19.2. This might lead to breaking
      code or invalid results. Use at your own risk. UserWarning)
      Traceback (most recent call last): File "rf_pred_model_tester.py",
      line 7, in
      print('Class: ',int(rf.predict(xx))) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/forest.py",
      line 538, in predict
      proba = self.predict_proba(X) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/forest.py",
      line 581, in predict_proba
      n_jobs, _, _ = _partition_estimators(self.n_estimators, self.n_jobs) File
      "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/ensemble/base.py",
      line 153, in _partition_estimators
      n_jobs = min(_get_n_jobs(n_jobs), n_estimators) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/utils/init.py",
      line 464, in _get_n_jobs
      if n_jobs < 0: TypeError: '<' not supported between instances of 'NoneType' and 'int'




      here is the code that i am trying to run



      import pickle
      import numpy as np
      with open('rf_model_1','rb') as f:
      rf=pickle.load(f)

      xx = np.array([67, 17832, 1, 1, 0, 33, 1941902452, 36, 33011.0, 19, 18, 0, 2, 1]).reshape(1,-1)
      print('Class: ',int(rf.predict(xx)))


      I'm expecting a result like this :



      Class: [0]


      if i run the code on jupyter its working fine but, i'm getting error when i try to run on terminal.







      python-3.x






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 23 at 14:44









      Riccardo Bonesi

      192213




      192213










      asked Mar 23 at 14:38









      Rishiraj SalamRishiraj Salam

      35




      35






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Your error put it bluntly:




          UserWarning: Trying to unpickle estimator RandomForestClassifier from version 0.20.2 when using version 0.19.2. This might lead to breaking code or invalid results. Use at your own risk.




          And indeed that is what happened; when pickling, your RandomForestClassifier's attribute n_jobs was kept at None. This is the default value for initialization, but behind the scenes this is usually set to 1. You can find more details on n_jobs here: https://scikit-learn.org/stable/glossary.html#term-n-jobs



          For you, setting rf's n_jobs to 1 will do the trick:



          import pickle
          import numpy as np
          with open('rf_model_1','rb') as f:
          rf=pickle.load(f)

          rf.n_jobs = 1

          xx = np.array([67, 17832, 1, 1, 0, 33, 1941902452, 36, 33011.0, 19, 18, 0, 2, 1]).reshape(1,-1)
          print('Class: ',int(rf.predict(xx)))





          share|improve this answer








          New contributor



          DvdV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.



















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314830%2ftypeerror-not-supported-between-instances-of-nonetype-and-int%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Your error put it bluntly:




            UserWarning: Trying to unpickle estimator RandomForestClassifier from version 0.20.2 when using version 0.19.2. This might lead to breaking code or invalid results. Use at your own risk.




            And indeed that is what happened; when pickling, your RandomForestClassifier's attribute n_jobs was kept at None. This is the default value for initialization, but behind the scenes this is usually set to 1. You can find more details on n_jobs here: https://scikit-learn.org/stable/glossary.html#term-n-jobs



            For you, setting rf's n_jobs to 1 will do the trick:



            import pickle
            import numpy as np
            with open('rf_model_1','rb') as f:
            rf=pickle.load(f)

            rf.n_jobs = 1

            xx = np.array([67, 17832, 1, 1, 0, 33, 1941902452, 36, 33011.0, 19, 18, 0, 2, 1]).reshape(1,-1)
            print('Class: ',int(rf.predict(xx)))





            share|improve this answer








            New contributor



            DvdV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.























              0














              Your error put it bluntly:




              UserWarning: Trying to unpickle estimator RandomForestClassifier from version 0.20.2 when using version 0.19.2. This might lead to breaking code or invalid results. Use at your own risk.




              And indeed that is what happened; when pickling, your RandomForestClassifier's attribute n_jobs was kept at None. This is the default value for initialization, but behind the scenes this is usually set to 1. You can find more details on n_jobs here: https://scikit-learn.org/stable/glossary.html#term-n-jobs



              For you, setting rf's n_jobs to 1 will do the trick:



              import pickle
              import numpy as np
              with open('rf_model_1','rb') as f:
              rf=pickle.load(f)

              rf.n_jobs = 1

              xx = np.array([67, 17832, 1, 1, 0, 33, 1941902452, 36, 33011.0, 19, 18, 0, 2, 1]).reshape(1,-1)
              print('Class: ',int(rf.predict(xx)))





              share|improve this answer








              New contributor



              DvdV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.





















                0












                0








                0







                Your error put it bluntly:




                UserWarning: Trying to unpickle estimator RandomForestClassifier from version 0.20.2 when using version 0.19.2. This might lead to breaking code or invalid results. Use at your own risk.




                And indeed that is what happened; when pickling, your RandomForestClassifier's attribute n_jobs was kept at None. This is the default value for initialization, but behind the scenes this is usually set to 1. You can find more details on n_jobs here: https://scikit-learn.org/stable/glossary.html#term-n-jobs



                For you, setting rf's n_jobs to 1 will do the trick:



                import pickle
                import numpy as np
                with open('rf_model_1','rb') as f:
                rf=pickle.load(f)

                rf.n_jobs = 1

                xx = np.array([67, 17832, 1, 1, 0, 33, 1941902452, 36, 33011.0, 19, 18, 0, 2, 1]).reshape(1,-1)
                print('Class: ',int(rf.predict(xx)))





                share|improve this answer








                New contributor



                DvdV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                Your error put it bluntly:




                UserWarning: Trying to unpickle estimator RandomForestClassifier from version 0.20.2 when using version 0.19.2. This might lead to breaking code or invalid results. Use at your own risk.




                And indeed that is what happened; when pickling, your RandomForestClassifier's attribute n_jobs was kept at None. This is the default value for initialization, but behind the scenes this is usually set to 1. You can find more details on n_jobs here: https://scikit-learn.org/stable/glossary.html#term-n-jobs



                For you, setting rf's n_jobs to 1 will do the trick:



                import pickle
                import numpy as np
                with open('rf_model_1','rb') as f:
                rf=pickle.load(f)

                rf.n_jobs = 1

                xx = np.array([67, 17832, 1, 1, 0, 33, 1941902452, 36, 33011.0, 19, 18, 0, 2, 1]).reshape(1,-1)
                print('Class: ',int(rf.predict(xx)))






                share|improve this answer








                New contributor



                DvdV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                share|improve this answer



                share|improve this answer






                New contributor



                DvdV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.








                answered yesterday









                DvdVDvdV

                11




                11




                New contributor



                DvdV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.




                New contributor




                DvdV is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.































                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55314830%2ftypeerror-not-supported-between-instances-of-nonetype-and-int%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현