Giter Club home page Giter Club logo

biclustpy's Introduction

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 by weights 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 row i and column k if and only if weights[i,k] > 0.
  • Deleting an existing edge (i,k) incurs cost weights[i,k].
  • Inserting a non-existing edge (i,k) incurs cost -weights[i,k].

Installation

  1. Download and install Gurobi and obtain a license by following the instructions in the installation guide for Linux, Mac OS, or Windows.
  2. 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.compute_bi_clusters(weights, algorithm): Use this function to solve a bi-cluster editing problem.
    • weights: The problem instance given as a numpy.array.
    • algorithm: The selected algorithm given as a bp.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 by bp.compute_bi_clusters.
    • obj_val: The objective value of the bi-clusters returned by bp.compute_bi_clusters.
    • is_optimal: A flag returned by bp.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()
time_limit = 100
tune = True
algorithm.use_ilp(100, 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.

biclustpy's People

Contributors

dbblumenthal avatar

Stargazers

Vishal Belsare avatar

Forkers

vishalbelsare

biclustpy's Issues

AttributeError in save_bi_clusters_as_xml

In your example you use the following code:

bp.save_bi_clusters_as_xml(filename,bi_clusters, obj_val, is_optimal, instance)

But since save_bi_clusters_as_xml it not in __init__.py, this produces an error.

So you either need to write:

bp.main.save_bi_clusters_as_xml(filename,bi_clusters, obj_val, is_optimal, instance)

or add the function to __init__.py

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.