Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • crtrees conformability error diagnosis

    Could some help me diagnose what is causing this error? Here is a MVCE:

    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . crtrees rep78 price mpg, class seed(846)
    
    Classification Trees with learning and test samples (SE rule: 0)
                 _yAk6bvkx():  3200  conformability error
                 _REAj4BLL():     -  function returned error
                     <istmt>:     -  function returned error
    r(3200);
    It's happening at

    Code:
     - noi mata: _REAj4BLL("`depvar'","`splvar'","`touse'","`learn_smpl'","`test_smpl'", `stop',`rule',"`impurity'","`priors'","`costs'",`vcv', "`jUYYJ5Vnol'","`coeficientes'","`ajustes'","`criterios'","`predicciones'", "`minmax'","`podas
    > '","`secuencia'","`clases'")
      = noi mata: _REAj4BLL("rep78","price mpg","__000000","__000004","__000005", 2,0,"gini","__00000X","__00000Y",2147483647, "__000007","__000008","__00000B","__00000D","__00000F", "__00000S","__00000I","__00000T","__00000U")
                 _yAk6bvkx():  3200  conformability error
                 _REAj4BLL():     -  function returned error
                     <istmt>:     -  function returned error
        }
    I am not sure what is going wrong. I get this error whenever the outcome has more than 2 classes. The help file has "The output variable depvar contains J classes or types.", so this should be possible, but there are no classification examples for J>2.

  • #2
    crtrees was developed by Ricardo Mora and is available from SSC.

    Comment


    • #3
      I would just send your question to the author of this command. The code looks for me too complicated for an easy debugging by someone who has no deeper understanding of the code.

      Comment


      • #4
        Hi Dimitriy, did you find a solution in the end?
        Guidance, Guest
        Last edited by sladmin; 25 May 2022, 13:09. Reason: anonymize original poster

        Comment


        • #5
          No, I threw in the towel and just used R from within Stata.

          Comment


          • #6
            Do you mind sharing your code for how to use R from within Stata for this problem. I am struggling with the same issue. I have a classification variable with 5 categories, I recognize this was several years ago but perhaps you still have it? Thanks! Guest did you discover a way within stata?
            Thank you- greer
            Last edited by sladmin; 25 May 2022, 13:09. Reason: anonymize original poster

            Comment


            • #7
              Hi Dimitriy, okay, thanks!
              Greer: No, I didn't, so I called a Python script from within Stata which uses the RandomForestClassifier from sklearn, creates a new dataset with the predictions and afterwards read this dataset into Stata again... It should be similar for R, shouldn't it?
              Good luck,
              Guest
              Last edited by sladmin; 25 May 2022, 13:09. Reason: anonymize original poster

              Comment


              • #8
                crtress runs pretty slow

                Comment

                Working...
                X