random-forest

RandomForest project

RandomForest project Question: I am very new and fresh to machine learning and this is my first project I am working on as part of a college course. I chose UK football (soccer) matches. I have chosen to use a Random Forest. Using different sources I have managed to get 20 years worth of data …

Total answers: 2

scikit-learn RandomForestClassifier list all variables of an estimator tree?

scikit-learn RandomForestClassifier list all variables of an estimator tree? Question: I train a RandomForestClassifier as from sklearn.ensemble import RandomForestClassifier from sklearn.datasets import make_classification X, y = make_classification() clf = RandomForestClassifier() clf.fit(X,y) where X and y are some feature vectors and labels. Once the fit is done, I can e.g. list the depth of all trees …

Total answers: 1

AttributeError: module 'numpy' has no attribute 'float'

AttributeError: module 'numpy' has no attribute 'float' Question: from sklearn.ensemble import RandomForestClassifier When i run it in jupyter notebook after adding module ‘numpy’ has no attribute ‘float’ I am getting an error like this. library i added and the error i got I was trying to apply random forest, which is a machine learning model. …

Total answers: 1

Duplicated feature and criteria from sklearn RandomForest when examining the decision path

Duplicated feature and criteria from sklearn RandomForest when examining the decision path Question: I’m getting duplicated feature and threshold (CO2) when examining the decision tree from a random forest model. The code to visualize the tree is the following: estimator = model.estimators_[10] from sklearn.tree import export_graphviz # Export as dot file export_graphviz(estimator, out_file=’tree.dot’, feature_names = …

Total answers: 1

Mean Squared Error calculation instead of Gini

Mean Squared Error calculation instead of Gini Question: I have an information criterion with help of Gini. How can I change my code for Mean Squared Error instead of Gini? Python, the random forest task. def gini(labels): # to count the number of objects for different classes classes = {} for label in labels: if …

Total answers: 1

How to find the max depth in a random forest classifier?

How to find the max depth in a random forest classifier? Question: I’ve a random forest classifier in Python with default parameters. After the classifier is built is it possible to find the max depth in random forest classifier ? For decision tree classifier we have tree.max_depth(). Example : this I know we can set …

Total answers: 1

How to predict new data with trained sklearn model – Random Forest Regressor?

How to predict new data with trained sklearn model – Random Forest Regressor? Question: I am making a sklearn model (Random Forest Regressor), and have been successful in training it with my data, however, I am unsure of how to predict it. My CSV contains 2 items per row, a year (expressed in years since …

Total answers: 1

n_jobs parameter for random forest to select all but one/two of the processors

n_jobs parameter for random forest to select all but one/two of the processors Question: I would like to set the n_jobs parameter to as close to -1 but not include all processors. If we are using a 16VCPU machine, would this be equivalent to selecting n_jobs to 15? What if we want to select all …

Total answers: 1