<jupyter_start><jupyter_text>Random Forest Algorithim in Python  Applications-----------------1. used in remote sensing2. Object detection- esp in complicated environments  why? - training time is less - runs efficiently on large database; for large data, it produces highly accurately predictions -  can still be effective if when we have missing dataIt operates by having multiple decision trees, measures the unpredictability of data<jupyter_code>from sklearn.datasets import load_iris
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
import numpy as np
iris=load_iris()
iris=pd.DataFrame(data=iris, columns=iris.feature_names)
iris.head()


iris.keys()
# adding columns to the dataframe
iris['species']=pd.Categorical(values=['setosa','virginica','versicolor'])
iris.head()
print(iris)
# creating test and train data
iris['is_train']=np.random.uniform(0,1,len(iris)) <= .75
iris.head()
# creating dataframes with test and training rows
train,test=iris[iris['is_train']==True],iris[iris['is_train']==False]
print("number of observations in training data",len(train))
print("number of observations in the test data", len(test))
#converting species into digits

y=pd.factorize(train['species'])
y
features=iris.columns
features
# creating a random forest classifier
clf=RandomForestClassifier(n_jobs=2,random_state=0)
#training the classifier
clf.fit(train[features], y)
# testing the data
#clf.predict(test[features])
# next, view the predicted probabiities of the first ten observations
#clf.predict_proba(test[features])[0:10]
# mapping names for the plants for each predicted plant
#preds=iris['species']
#preds[clf.predict(test(features))]
#preds<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11378299120234604, 'fraction_numerical': 0.0064516129032258064, 'mean_word_length': 6.861751152073733, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '546917', 'license': 'Apache-2.0', 'n_tokens_mistral': 530, 'n_tokens_neox': 513, 'n_words': 159, 'path': 'RandomForestClassifier.ipynb', 'repo_name': 'bettytom/betty', 'size': '1705'}