Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

sklearn random forest

from sklearn.ensemble import RandomForestClassifier


clf = RandomForestClassifier(max_depth=2, random_state=0)

clf.fit(X, y)

print(clf.predict([[0, 0, 0, 0]]))
Comment

sklearn random forest

from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification


X, y = make_classification(n_samples=1000, n_features=4,
                            n_informative=2, n_redundant=0,
                            random_state=0, shuffle=False)
clf = RandomForestClassifier(max_depth=2, random_state=0)

clf.fit(X, y)

print(clf.predict([[0, 0, 0, 0]]))
Comment

scikit learn random forest

from sklearn.ensemble import BaggingClassifier
from sklearn.neighbors import KNeighborsClassifier
bagging = BaggingClassifier(KNeighborsClassifier(),
                            max_samples=0.5, max_features=0.5)
Comment

PREVIOUS NEXT
Code Example
Python :: open url from ipywidgets 
Python :: python all permutations of a string 
Python :: python switch columns order csv 
Python :: tkinter canvas text size 
Python :: decode multipart/form-data python lambda 
Python :: pyhton image resize 
Python :: python verify if string is a integer 
Python :: how to install httplib in python 
Python :: defaultdict initialize keys 
Python :: slicing in python 
Python :: url_for 
Python :: read an excel file 
Python :: df sort by column names 
Python :: reversed() python 
Python :: restrict ticks to integers matplotlib 
Python :: jupyter notebook spark 
Python :: how to read linux environment variable in python 
Python :: getting input in python 
Python :: cosh python 
Python :: python sort list by custom function 
Python :: max deviation in pandas 
Python :: create new column with mask pandas 
Python :: make tkinter text editing disabled 
Python :: poppler on colab 
Python :: Display head of the DataFrame 
Python :: python log file 
Python :: python read input 
Python :: abstract class python 
Python :: upload file to aws 
Python :: Python RegEx Split – re.split() 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =