How to Evaluate Network Embedding Methods with EvalNE

Jul 10, 2022 | Data Science

Welcome to our guide on using EvalNE, a powerful Python library designed for evaluating Network Embedding (NE) methods! Whether you’re a methodologist or a practitioner, this blog will guide you through the setup, usage, and troubleshooting of EvalNE.

About EvalNE

EvalNE is an open-source library that simplifies the process of assessing and comparing the performance of various Network Embedding methods. It offers automation for complex tasks like hyper-parameter tuning, model validation, and data visualization, helping you conduct evaluations with ease.

For Methodologists

  • EvalNE allows you to evaluate any embedding method compared to state-of-the-art techniques or replicate experimental setups from existing literature using configuration files.
  • It’s important to note that while EvalNE does not provide implementations of NE methods, it supports various external libraries, such as OpenNE and GEM.

For Practitioners

  • Use EvalNE as an API to load graphs, obtain statistics, and generate edge embeddings.
  • Utilize its functionality for tasks like link prediction, node classification, and more!

Installation

To install EvalNE, follow these steps:

  • Ensure Python 3.8 is installed and run the following commands to install required packages:
  • sudo apt-get install python3-pip
    sudo apt-get install python3-tk
  • Option 1: Install using pip:
  • pip install evalne
  • Option 2: Clone the repository and install:
  • git clone https://github.com/Dru-Mara/EvalNE.git
    cd EvalNE
    sudo python setup.py install

Usage

As a Command Line Tool

Use an *.ini* configuration file to run evaluations directly from the command line:

  • Download necessary methods and datasets.
  • Set dataset and method paths in your *.ini* file.
  • Run the evaluation using:
  • python -m evalne .examples/conf.ini

As an API

You can also use EvalNE within your Python scripts. Here’s a basic example:

from evalne.evaluation.evaluator import LPEvaluator
from evalne.evaluation.split import LPEvalSplit
from evalne.evaluation.score import Scoresheet
from evalne.utils import preprocess as pp

# Load and preprocess the graph
G = pp.load_graph('network.edgelist')
G, _ = pp.prep_graph(G)

# Create an evaluator and generate train/test edge split
traintest_split = LPEvalSplit()
traintest_split.compute_splits(G)
nee = LPEvaluator(traintest_split)

# Create a Scoresheet to store results
scoresheet = Scoresheet()
methods = [random_prediction, common_neighbours, jaccard_coefficient]

# Evaluate baselines for method in methods:
for method in methods:
    result = nee.evaluate_baseline(method=method)
    scoresheet.log_results(result)

Troubleshooting

If you run into issues during installation or usage, here are a few suggestions:

  • Ensure all dependencies are correctly installed.
  • Check for version compatibility with Python or libraries used.
  • Refer to the EvalNE documentation hosted by Read the Docs.

For further assistance or to collaborate on AI development projects, stay connected with fxis.ai.

Final Thoughts

At fxis.ai, we believe that advancements like EvalNE are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team continually explores new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox