QUESTION: (PYTHON PROGRAMMING)   Edit the code to reduce the black points ( black noise ).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.cluster import DBSCAN 
from sklearn.datasets import make_blobs

n_samples = [750,750,750]

cluster_std = 1

random_state = 200


X, Y_true = make_blobs(n_samples=n_samples, random_state=random_state, cluster_std=cluster_std)

plt.scatter(X[:, 0], X[:, 1], marker='.', c=Y_true)


#DBSCAN model, setting up required parameters 
eps = 0.4
min_Samples = 10
db = DBSCAN(eps=eps, min_samples=min_Samples).fit(X)
labels = db.labels_
labels

# To count number of clusters in labels, ignoring noise if present.
n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0)
n_noise_ = list(labels).count(-1)

print('Estimated number of clusters: %d' % n_clusters_)
print('Estimated number of noise points: %d' % n_noise_)


# Plot result
# Use black to label noise points.
unique_labels = set(labels)
colors = plt.cm.Spectral(np.linspace(0, 1, len(unique_labels)))

core_samples_mask = np.zeros_like(db.labels_, dtype=bool)
core_samples_mask[db.core_sample_indices_] = True

# Plot the points with colors
for k, col in zip(unique_labels, colors):
   if k == -1:
       # Black used for noise points.
       col = 'k'

   class_member_mask = (labels == k)
   
   # Plot the datapoints that are clustered
   xy = X[class_member_mask & core_samples_mask]
   plt.scatter(xy[:, 0], xy[:, 1], c=[col], marker=u'o', alpha=0.5)

   # Plot the border points and noise points
   xy = X[class_member_mask & ~core_samples_mask]
   plt.scatter(xy[:, 0], xy[:, 1], c=[col], marker=u'x', alpha=0.5)'

 

 

 

QUESTION: (PYTHON PROGRAMMING)

 

Edit the code to reduce the black points ( black noise ). 

 

TIP: adjust eps and min_Samples

 

https://ibb.co/b2jwzSy

 
 
 
 
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education