Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sklearn predict threshold

from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier(random_state = 2)
clf.fit(X_train,y_train)
# y_pred = clf.predict(X_test)  # default threshold is 0.5
y_pred = (clf.predict_proba(X_test)[:,1] >= 0.3).astype(bool) # set threshold as 0.3
Comment

PREVIOUS NEXT
Code Example
Python :: check if number in range python 
Python :: reading binary file 
Python :: pass context data with templateview in django 
Python :: python comment 
Python :: negative number factor python 
Python :: remove space from string python 
Python :: select pandas by t dtype python 
Python :: feature selection python 
Python :: get multiple inputs in python using map 
Python :: df empty python 
Python :: python list add element to front 
Python :: upload to test pypi 
Python :: pandas head sort by colun name 
Python :: print random integers python 
Python :: click a button using selenium python 
Python :: generate all combinatinosrs of a list pyton 
Python :: Handling categorical feature 
Python :: python dictionary to list 
Python :: python how to find circle circumference 
Python :: python documentation 
Python :: add to a list python 
Python :: deleting in a text file in python 
Python :: flask print request headers 
Python :: pyflakes invalid syntax 
Python :: create new column with length of old column value python 
Python :: how to get value from set in python 
Python :: how to check all the elements in a list are even or not 
Python :: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead 
Python :: fibonacci series using dynamic programmig approach 
Python :: python modulus 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =