Coder Social home page Coder Social logo

nero-fair_evaluation's Introduction

NERO

Network Embedding based on Relation Order histograms

Installation

While in project main directory (containing the Dockerfile file), run the following command.

docker build -t nero:latest .

Then use the prepared image as a remote Python intepreter. Remember to bind the appropriate container volumes (code and storage locations).

docker run -it --rm --name nero_interpreter -v {project directory path}:/projects/NERO -v {desired storage and output path}:/nero --entrypoint python3 nero /projects/NERO/main.py

Usage

The graph embedding tool can be set up using an object-oriented API.

from nero import constants
from nero.embedding import compressors, digitisers, embedders
from nero.tools import distributions


embedder = embedders.NeroEmbedder(
        bin_generators=[
            digitisers.LabelBinGenerator(
                relevant_property=digitisers.RelevantProperty(
                    name="vertex_label_0", 
                    origin=digitisers.VertexOrigin.NODE,
                ),
            ),
            digitisers.EqualProbabilityBinGenerator(
                relevant_property=digitisers.RelevantProperty(
                    name="edge_attribute_0", 
                    origin=digitisers.VertexOrigin.EDGE,
                ),
                bins_no=20,
                insight_bins_generator=digitisers.InsightBinGenerator(
                    calculate_bins=distributions.equal_size_bins,
                    bins_no=constants.INSIGHT_BINS_NO,
                    bin_type='equal',
                ),
            ),
        ],
        relation_order_compressor=compressors.VGGInspiredROC(
            bins_no=20,
        ),
        jobs_no=8,
    )

It is recommended to use the aforementioned embedder as a part of a scikit-learn processing pipeline.

import sklearn.pipeline as skl_pipeline
import sklearn.preprocessing as skl_preprocessing
import sklearn.ensemble as skl_ensemble

from nero.pipeline.transform import normalise, resize


pipeline = skl_pipeline.Pipeline([
        ('embed', embedder),
        ('resize_to_smallest_common_shape', resize.ToSmallestCommonShape()),
        ('normalise', normalise.PercentOfMaxPerRelationOrder()),
        ('flatten', resize.FlattenUpperTriangles()),
        ('scale', skl_preprocessing.StandardScaler()),
        ('classify', skl_ensemble.ExtraTreesClassifier(
            n_estimators=1000,
            n_jobs=8,
            verbose=False
        )),
    ])

For more detailed usage information check the demonstration example enclosed in the source code and the accompanying conference paper.

BibTeX

@inproceedings{lazarz2021relation,
  title={Relation Order Histograms as a Network Embedding Tool},
  author={{\L}azarz, Rados{\l}aw and Idzik, Micha{\l}},
  booktitle={International Conference on Computational Science},
  pages={224--237},
  year={2021},
  organization={Springer}
}

PWC PWC PWC PWC

nero-fair_evaluation's People

Contributors

prpht avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.