# Column name and type: # nFires (int) Number of fires in the area # perW (float) Percentage of women (noted as float, e.g. 0.51) # perM (float) Percentage of men (noted as float, e.g. 0.51) # perSH (float) Percentage of single households (noted as float, e.g. 0.51) # perMH (float) Percentage of more person households (noted as float, e.g. 0.51) # group0to40 (float) Percentage of people aged 0 to 40 (noted as float, e.g. 0.51) # group40to80 (float) Percentage of people aged 40 to 80 (noted as float, e.g. 0.51) # group80up (float) Percentage of people aged 80 and up (noted as float, e.g. 0.51) import pandas as pd from sklearn.ensemble import RandomForestClassifier names = ['nFires', 'perW', 'perM', 'perSH', 'perMH', 'group0to40', 'group40to80', 'group80up'] fireData = pd.read_csv('link_to_csv', delimiter=r"\s+", names=names, header=None, engine='python') X = fireData[['perW', 'perM', 'perSH', 'perMH', 'group0to40', 'group40to80', 'group80up']] Y = fireData['nFires'] clf = RandomForestClassifier(n_estimators = x, criterion = 'entropy', max_depth = 10, min_samples_leaf = 5) clf = clf.fit(X, Y)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question