liveBook · Manning

Random forest

As explained in Graph Algorithms for Data Science

A random forest model is an ensemble of decision trees whose aggregated predictions perform classification or regression.

A random forest is used as a practical classification model for turning graph-derived representations or relationship features into predictions. section 9.2 section 10.4

A typical workflow prepares labeled data, trains the classifier, and evaluates its predictions:

  • Encode categorical language labels as integers with pandas factorization. section 9.3.5
  • Use node2vec embeddings as inputs for predicting the languages of new streams. section 9.2 section 9.3.5
  • Split features and targets into training and test sets, then fit RandomForestClassifier on the training portion. section 9.3.5 section 10.4.2
  • Predict whether a future link will form from relationship features such as network distance, common neighbors, and preferential attachment. section 10.4 section 10.4.2

Predicting streamer languages

Retrieve each stream's identifier, language, and node2vec embedding; encode languages as outputs; split the data; and train a random forest classifier to predict languages for new streams. section 9.3.5

Figure 9.6 The process of predicting the language for new streams
09-06

Use the process figure to follow the path from graph-derived embeddings through classification to language predictions for new streams. section 9.2

How Graph Algorithms for Data Science covers it

How deep it goes
Walks through label encoding, train/test splitting, fitting, and evaluation while deferring hyperparameter optimization.
Examples
Uses streamer-language prediction and binary future-link prediction with graph embeddings or relationship features.
What it assumes
Requires Jupyter, Neo4j, Python, and scikit-learn while teaching label encoding and train/test preparation within the workflow.
What you can do after
Apply it via scikit-learn to train classifiers from prepared graph features and assess predictions with classification reports and confusion matrices.
How it connects
Connects random forests with node2vec, node embeddings, link prediction, feature scaling, collinearity, logistic regression, and support vector machines.

Also explained in

Compare how 11 books explain random forest →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.