I use python to run the random forest on an imbalanced dataset with binary target class. I wanna change the default probabilistic threshold 0.5 to another value to raise the recall and precision. I cannot find so far any defined method or class which can be used to conduct this task. Could anyone please advice a method or did it mean I should code for it myself? Cheers
How to set up my own probabilistic threshold in random forest?
3.1k Views Asked by LUSAQX At
1
There are 1 best solutions below
Related Questions in PYTHON
- new thread blocks main thread
- Extracting viewCount & SubscriberCount from YouTube API V3 for a given channel, where channelID does not equal userID
- Display images on Django Template Site
- Difference between list() and dict() with generators
- How can I serialize a numpy array while preserving matrix dimensions?
- Protractor did not run properly when using browser.wait, msg: "Wait timed out after XXXms"
- Why is my program adding int as string (4+7 = 47)?
- store numpy array in mysql
- how to omit the less frequent words from a dictionary in python?
- Update a text file with ( new words+ \n ) after the words is appended into a list
- python how to write list of lists to file
- Removing URL features from tokens in NLTK
- Optimizing for Social Leaderboards
- Python : Get size of string in bytes
- What is the code of the sorted function?
Related Questions in MACHINE-LEARNING
- How to cluster a set of strings?
- Enforcing that inputs sum to 1 and are contained in the unit interval in scikit-learn
- scikit-learn preperation
- Spark MLLib How to ignore features when training a classifier
- Increasing the efficiency of equipment using Amazon Machine Learning
- How to interpret scikit's learn confusion matrix and classification report?
- Amazon Machine Learning for sentiment analysis
- What Machine Learning algorithm would be appropriate?
- LDA generated topics
- Spectral clustering with Similarity matrix constructed by jaccard coefficient
- Speeding up Viterbi execution
- Memory Error with Classifier fit and partial_fit
- How to find algo type(regression,classification) in Caret in R for all algos at once?
- Difference between weka tool's correlation coefficient and scikit learn's coefficient of determination score
- What are the approaches to the Big-Data problems?
Related Questions in RANDOM-FOREST
- Is Gradient Boosting regression be more accurate (lower MSE) than the random forest?
- randomForest package in R mse calculation
- Big accuracy difference between cross-validation and testing with a test set in weka? is it normal?
- displaying variable in plot(varImp(randomForest_model))
- Encoding String to numbers so as to use it in scikit-learn
- Using the predict_proba() function of RandomForestClassifier in the safe and right way
- Why connection is terminating
- How to change the function a random forest uses to make decisions from individual trees?
- What is the equivalent to rpart.plot in Python? I want to visualize the results of my random forest
- How to predict probabilities on test dataset in R's caret package?
- R package for Weighted Random Forest? classwt option?
- is their any way to show random forest as nonlinear using suppose 100 attributes
- Is this the correct way of getting in-sample and out-of-sample predictions / performance in R's caret package?
- How to collapse a RandomForest into an equivalent decision tree?
- Random forests performed under expectation
Related Questions in THRESHOLD
- How to create rotated rectangular or polygonal ROI/mask?
- dynamic threshold values in highchart - arearange
- gamma distribution lower limit in R
- How to set up my own probabilistic threshold in random forest?
- log4j2 threshold for consoleappender
- Hashmap Capacity not increased even on reaching threshold
- R filter raster using focal() with threshold - defining correct function
- Adjusting image to select thresholded pixels as a ROI in a 8-bit image, using ImageJ
- Adaptive Threshold OpenCV IOS
- Applying Threshold to Matrix Within Cell Array
- Why my BGR2GRAY Mat returns a color blue in a basic threshold function? [OPENCV]
- Histogram of image not showing expected distribution
- set threshold for the probability result from decision tree
- How to make code coverage threshold on gitlab or in YAML
- Eliminate the values in the rows corresponding to a column which are zero in MATLAB
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?
The RandomForestClassifier of scikit-learn has no fixed threshold to assign a class to sample. As you can see in the source code of RandomForestClassifier.predict it simply returns the most likely class. Of course you can use the approach suggested by @thiom but I can hardly imagine that this will improve precision and recall.
For instance, if your chosen threshold is 0.7 and the class probabilities are 0.6 and 0.4 what class do you assign? None at all?
As an alternative, you can try to use the
class_weightoption of RandomForestClassifier to put more weight on your underrepresented class.