How does a random forest algorithm deal with a few irrelevant input variables
Random Forest tends to be not too sensitive to features with low predictive power. The reason is that RF looks for a &quot;best split&quot; given a subset of features (columns) and observations (rows). So &quot;weak&quot; features will likely be ignored in most cases.
However, removing the $x$ percent weakest features may increase the model's performance. In case you use sklearn, there are convenience functions to do this, e.g. SelectFromModel(). See the docs for more details.
&gt;&gt;&gt; from sklearn.ensemble import ExtraTreesClassifier
&gt;&gt;&gt; from sklearn.datasets import load_iris
&gt;&gt;&gt; from sklearn.feature_selection import SelectFromModel
&gt;&gt;&gt; X, y = load_iris(return_X_y=True)
&gt;&gt;&gt; X.shape
(150, 4)
&gt;&gt;&gt; clf = ExtraTreesClassifier(n_estimators=50)
&gt;&gt;&gt; clf = clf.fit(X, y)
&gt;&gt;&gt; clf.feature_importances_  
array([ 0.04...,  0.05...,  0.4...,  0.4...])
&gt;&gt;&gt; model = SelectFromModel(clf, prefit=True)
&gt;&gt;&gt; X_new = model.transform(X)
&gt;&gt;&gt; X_new.shape               
(150, 2)