I am trying to code a two class classification DT problem that I used SAS EM before. But trying to do it in Sklearn. The target variable is a two class categorical variable. But there are a few continuous independent variables. In SAS I could specify the "Maximum Number of Branches" for each split. So when it is set to 4, some leaf will split into 2 and some in 4 (especially for continuous variables). I could not find an equivalent parameter in sklearn. Looked at "max_leaf-nodes". But that controls the total number of "leaf" nodes of the entire tree. I am sure some of you probably has faced the same situation and already found a solution. Please help/share. I will really appreciate it.
sklearn decision tree classifier: How to control max number of branches of each split
1.9k Views Asked by ArinB At
1
There are 1 best solutions below
Related Questions in PYTHON-3.X
- SQLAlchemy 2 Can't add additional column when specifying __table__
- Writes to child subprocess.Popen.stdin don't work from within process group?
- Platform Generation for a Sky Hop clone
- What's the best way to breakup a large test in pytest
- chess endgame engine in Python doesn't work perfectly
- Function to create matrix of zeros and ones, with a certain density of ones
- how to create a polars dataframe giving the colum-names from a list
- Django socketio process
- How to decode audio stream using tornado websocket?
- Getting website metadata (Excel VBA/Python)
- How to get text and other elements to display over the Video in Tkinter?
- Tkinter App - My Toplevel window is not appearing. App is stuck in mainloop
- Can I use local resources for mp4 playback?
- How to pass the value of a function of one class to a function of another with the @property decorator
- Python ModuleNotFoundError for command line tools built with setup.py
Related Questions in TREE
- Python - how to make tree without any library
- how to get the full path of antd tree
- Python Quadtree won't insert values
- Top View Of Binary Tree Depth First Search Using TreeMap
- Select/filter tree structure in postgres
- PySimpleGUI tree doesn't Insert data into tree
- Is it possible to create a node-link diagram with ggplot?
- Represent a full, but not complete, binary tree with an array structure
- Redirecting stdout with execvp
- Prevent selected node to be unselect primevue Tree component
- Binary Search Tree (BST) - array representations
- Debugging AVL Tree Deletion: Unbalanced Node Not on Deletion Path
- How to shorten line length in react-d3-tree
- installed dm-tree vs imported tree
- Why the height of segment tree is O(logn)
Related Questions in SCIKIT-LEARN
- How to transfer object dataframe in sklearn.ensemble methods
- Calculating explained_variance_score, result are different between manual method and function calling
- Scikit-Learn Permutating and Updating Polars DataFrame
- Train and test split in such a way that each name and proportion of tartget class is present in both train and test
- How to transform Dataframe Mapper to PMML?
- ValueError: The feature names should match those that were passed during fit
- How to plot OvO precision recall curve for a multi-class classifier?
- Error when evaluating models: Classification metrics can't handle a mix of binary and continuous targets
- my code always give convergencewarning for every iteration(even 1) please give a solution to that
- Remove empty outputs from scikit-learn KDtree.query_radius() and get unique values
- Grouping Multiple Rows of Data For Use In scikit-learn Random Forest Machine Learning Model
- I am trying to build an AI image classifier in Python using a youtube guide. When I run my program (unfinished) it does not open up the image
- Calling MinMaxScaler differs between same sets
- Compute scores for all point used to train KernelDensity
- How to quantify the consistency of a sequence of predictions, incl. prediction confidence, using standard function from sklearn or a similar library
Related Questions in SKLEARN-PANDAS
- How can l read and transform 7z file into csv using Pandas (python)?
- mapping back any sklearn result to the original dataframe
- Including a Python Script in a .net solution
- Error when trying to import sklearn modules : ImportError: DLL load failed: The specified module could not be found
- What's the difference between importing a whole module vs importing just the required method from the module in python?
- How to change particular column value when defined mask is true?
- Divide dataframe into two sets according to a column
- Map a Numpy array into a list of characters
- Difference between statsmodel OLS and scikit linear regression; different models give different r square
- Count vectorizer ValueError: Expected 2-dimensional array, got 1
- How to add a boundary to a figure (data set) using matplotlib and SVM algorithm?
- Append tfidf to pandas dataframe
- KerasClassifier error with categorical data
- Pandas Sklearn Pipeline - CV on DataMapper transforms?
- Move data from a column to seven days in advance - pandas Dataframe
Related Questions in CLASSIFIER4J
- WEKA 3.8.4 : Supplied Test Set Issue
- Is there a way to get tree data as a list with the LightGBM Classifier
- How to use NB algorithm for this classifier
- sklearn decision tree classifier: How to control max number of branches of each split
- How implantation MKNN Algorithm In Matlab
- How to summarize the main content of an article in a webpage?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I don't think this option is available in sklearn, You will find this Post very useful for your Classification DT; as it lists all the options you have available.
I would recommend creating Bins for your continues variables; this way you force the branches to be the number of bins you have.
Example: For continuous variable COl1 has values between 1-100; you can create a 4 bins 1-25, 26-50 , 51-75, 76-100. or you can create the bins bases on the median.