Get started

The BlocksNet library can be installed with pip right from the jupyter notebook cell. But if you have to setup the environment please check the advanced guides on how to proceed with the library:

Installation

BlocksNet can be installed with pip:

pip install blocksnet

There are various extras to install:

  • ml - machine learning related packages (torch, catboost, etc).

  • opt - optimization problem related packages (optuna, pymoo).

  • full - all packages required by blocksnet methods (ml + opt extras).

  • ipynb - jupyter notebook visualization packages (matplotlib, etc).

  • tests (DEVELOPMENT ONLY) - pytest related packages.

  • docs (DEVELOPMENT ONLY) - sphinx documentation related packages.

  • dev (DEVELOPMENT ONLY) - development related packages and all extras.

We recommend installing full and ipynb extras:

pip install blocksnet[full,ipynb]

How to use

Use the library by importing functions and classes from blocksnet modules:

import pandas as pd
from blocksnet.analysis.network import mean_accessibility

acc_mx = pd.DataFrame([
   [0,7,5],
   [9,0,3],
   [5,4,0]
])

mean_acc_df = mean_accessibility(acc_mx)
mean_acc_df
>>> mean_acc_df
   mean_accessibility
0                 4.0
1                 4.0
2                 3.0