bi-cluster editing library
Project description
biclustpy
A Python library for bi-cluster editing.
The Bi-Cluster Editing Problem
- Task: Given a matrix
weights
with positive and negative weights, transform the bipartite graph induced byweights
into a disjoint collection of bi-cliques (bi-clusters) via edge insertions and deletions, such that the overall transformation cost is minimal. - The node sets of the bipartite graph induced by
weights
are the sets of rows and columns. There is an edge between rowi
and columnk
if and only ifweights[i,k] > 0
. - Deleting an existing edge
(i,k)
incurs costweights[i,k]
. - Inserting a non-existing edge
(i,k)
incurs cost-weights[i,k]
.
Installation
- Download and install Gurobi and obtain a license by following the instructions in the installation guide for Linux, Mac OS, or Windows.
- Open a shell and execute
pip install biclustpy
.
Library Usage
After installation, import biclustpy as bp
into your Python application. Then use it as follows:
bp.Algorithm
: Use this class to select the algorithm you want to employ.bp.Algorithm.algorithm_name
: String you can use to select the algorithm you want to employ. Default:"ILP"
.- Set to
"ILP"
if you want to use Gurobi to solve the ILP formulation suggested in G. F. de Sousa Filho et al (2017): New heuristics for the bicluster editing problem. - Set to
"CH"
if you want to use the constructive heuristic suggested in G. F. de Sousa Filho et al (2017): New heuristics for the bicluster editing problem. - More algorithms are following soon.
- Set to
bp.Algorithm.ilp_time_limit
: Integer that specifies a time limit in seconds for the optimization and the tuning phase of the algorithm"ILP"
. Default:60
.bp.Algorithm.ilp_tune
: Boolean flag that indicates whether or not"ILP"
should be tuned before being optimized. Default:False
.
bp.compute_bi_clusters(weights, algorithm)
: Use this function to solve a bi-cluster editing problem.weights
: The problem instance given as anumpy.array
.algorithm
: The selected algorithm given as abp.Algorithm
object.
bp.save_bi_clusters_as_xml(filename, bi_clusters, obj_val, is_optimal, instance = "")
: Use this function to save the obtained solution as an XML file.filename
: The name of the XML file.bi_clusters
: The bi-clusters returned bybp.compute_bi_clusters
.obj_val
: The objective value of the bi-clusters returned bybp.compute_bi_clusters
.is_optimal
: A flag returned bybp.compute_bi_clusters
that indicates whether the computed bi-clusters are guaranteed to be optimal.instance
: A string that contains information about the problem instance.
Example
import numpy as np
import biclustpy as bp
algorithm = bp.Algorithm
algorithm.algorith_name = "ILP"
algorithm.ilp_time_limit = 100
algorithm.ilp_tune = True
n = 30
m = 40
t = .95
weights = np.random.rand(n, m) - (t * np.ones((n, m)))
bi_clusters, obj_val, is_optimal = bp.compute_bi_clusters(weights, algorithm)
filename = "bi_clusters.xml"
instance = "random instance with 30 rows and 40 columns"
bp.save_bi_clusters_as_xml(filename, bi_clusters, obj_val, is_optimal, instance)
Command Line Usage
Upon installation, you can run biclustpy
from the command line. Usage:
biclustpy [-h]
(--load input-file | --random num-rows num-cols threshold seed)
[--save output-file] [--alg {ILP,CH}]
[--ilp_options time-limit tune]
More more information, execute biclustpy -h
.
License
You may use and distribute biclustpy under the terms of the GNU Lesser General Public License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
biclustpy-0.2.tar.gz
(9.7 kB
view details)
Built Distribution
biclustpy-0.2-py3-none-any.whl
(13.9 kB
view details)
File details
Details for the file biclustpy-0.2.tar.gz
.
File metadata
- Download URL: biclustpy-0.2.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce02bd7550fdd6b3c098c8c7be31cbcbeb3265e5514af154d62b05b0c2e7dfa6 |
|
MD5 | d2863b54fe2e3cb1016ca05be7fd4f50 |
|
BLAKE2b-256 | 9f318ea98164e5cbb1aca880333be81f91dda0760a38ad34b6183f38fbd9c3ab |
File details
Details for the file biclustpy-0.2-py3-none-any.whl
.
File metadata
- Download URL: biclustpy-0.2-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5134babd641443891263cb9bf536b2f6a2ab4a9b53a258f9974e4ee037461013 |
|
MD5 | d1d71f7ad143ad24a84fbbe1f4b2595b |
|
BLAKE2b-256 | 80e988ff8832a9642e53970005c680b73b1694153445e032cb21e872160ded58 |