Checking spectral co-clustering also accuracy

0 votes
I want python code for the following requirements:

A dataset is generated using make_biclusters function. The rows and columns are then shuffled and It's then sent to spectral co-clustering also. I would like to rearrange the shuffled matrix and show how accurately the algorithm found the biclusters.

Thank you
Jun 3, 2019 in Machine Learning by Anmol

1 answer to this question.

0 votes

Hi Vishal, you could try something like this:

import numpy as np
from matplotlib import pyplot as plt

from sklearn.datasets import make_biclusters
from sklearn.datasets import samples_generator as sg
from sklearn.cluster.bicluster import SpectralCoclustering
from sklearn.metrics import consensus_score

data, rows, columns = make_biclusters(
    shape=(300, 300), n_clusters=5, noise=5,
    shuffle=False, random_state=0)

plt.title("Original dataset")

data, row_idx, col_idx = sg._shuffle(data, random_state=0)
plt.title("Shuffled dataset")

model = SpectralCoclustering(n_clusters=5, random_state=0)
score = consensus_score(model.biclusters_,
                        (rows[:, row_idx], columns[:, col_idx]))

print("consensus score: {:.3f}".format(score))

fit_data = data[np.argsort(model.row_labels_)]
fit_data = fit_data[:, np.argsort(model.column_labels_)]

plt.title("After biclustering; rearranged to show biclusters")
answered Jun 3, 2019 by Yamini

Related Questions In Machine Learning

0 votes
1 answer

What are different clustering methods?

Different clustering methods include: 1. Density-Based Methods: These methods ...READ MORE

answered May 9, 2019 in Machine Learning by Vishal
0 votes
1 answer

Clustering algorithms

These are the clustering algorithms that are ...READ MORE

answered May 9, 2019 in Machine Learning by Nisha
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,081 views
0 votes
1 answer

What is clustering in Machine Learning?

Clustering is a type of unsupervised learning ...READ MORE

answered May 9, 2019 in Machine Learning by Shridhar
0 votes
1 answer

Calculating accuracy of prediction of rpart model

Your first task would be to build ...READ MORE

answered Apr 4, 2018 in Data Analytics by Bharani
• 4,560 points
0 votes
1 answer

Why would you choose Blob Storage over File Storage which also has ability to store file(s) and folder(s)

Azure Files: Azure File storage provides shared ...READ MORE

answered Apr 13, 2018 in Azure by null_void
• 3,220 points

edited Apr 13, 2018 by null_void 155 views
0 votes
1 answer

trigger an event after checking into TFS

You essentially can't do this in TVFC. ...READ MORE

answered Apr 13, 2018 in DevOps & Agile by DareDev
• 6,850 points