Package: biclustpy
biclustpyA Python library for bi-cluster editing.The Bi-Cluster Editing ProblemTask: Given a matrixweightswith positive and negative weights, transform the bipartite graph induced byweightsinto 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 byweightsare the sets of rows and columns. There is an edge between rowiand columnkif 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].InstallationDownload and installGurobiand obtain a license by following the instructions in the installation guide forLinux,Mac OS, orWindows.Open a shell and executepip install biclustpy.Library UsageAfter installation,import biclustpy as bpinto 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 inG. 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 inG. F. de Sousa Filho et al (2017): New heuristics for the bicluster editing problem.More algorithms are following soon.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.Algorithmobject.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_clustersthat indicates whether the computed bi-clusters are guaranteed to be optimal.instance: A string that contains information about the problem instance.Exampleimport 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 UsageUpon installation, you can runbiclustpyfrom 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, executebiclustpy -h.LicenseYou may use and distributebiclustpyunder the terms of theGNU Lesser General Public License.