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 in Machine Learning by Anmol

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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 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 in Machine Learning by Vishal
0 votes
1 answer

Clustering algorithms

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

answered May 9 in Machine Learning by Nisha
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
0 votes
1 answer

What is clustering in Machine Learning?

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

answered May 9 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,550 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 33 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,670 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.