could you write a python code program using version 3 and jupyter notebook to implement DBSCAN algorithm?
code:
import matplotlib.pyplot as plt
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
# generating sampl data
centers = [[5, 5], [0, 0], [1, 5],[5, -1]]
X, labels_true =make_blobs(n_samples=500, n_features=5,
centers=centers, cluster_std=0.9, center_box=(1, 10.0),
shuffle=True, random_state=0)
# Compute DBSCAN
db = DBSCAN(eps=0.5, min_samples=10).fit(X)
#zeros_like :Return an array of zeros with the same shape and
type as a given array., dtype will overrides the data type of the
result.
core_samples_mask = np.zeros_like(db.labels_, dtype=bool)
#core_sample_indices_ : Attributes and it is index of core
samples (array, shape = [n_core_samples])
core_samples_mask[db.core_sample_indices_] = True
labels = db.labels_
# Number of clusters in labels, ignoring noise if present.
n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0)
#print results
print('Estimated number of clusters: %d' % n_clusters_)
print("Homogeneity: %0.3f" % metrics.homogeneity_score(labels_true,
labels))
print("Completeness: %0.3f" %
metrics.completeness_score(labels_true, labels))
print("V-measure: %0.3f" % metrics.v_measure_score(labels_true,
labels))
print("Adjusted Rand Index: %0.3f"%
metrics.adjusted_rand_score(labels_true, labels))
print("Adjusted Mutual Information: %0.3f"%
metrics.adjusted_mutual_info_score(labels_true, labels))
print("Silhouette Coefficient: %0.3f"% metrics.silhouette_score(X,
labels))
# Drawing chart
# Black removed and is used for noise instead.
unique_labels = set(labels)
colors = plt.cm.Spectral(np.linspace(0, 1,
len(unique_labels)))
for k, col in zip(unique_labels, colors):
if k == -1:
# Black used for noise.
col = 'k'
class_member_mask = (labels == k)
xy = X[class_member_mask & core_samples_mask]
plt.plot(xy[:, 0], xy[:, 1], 'o', markerfacecolor=col,
markeredgecolor='k', markersize=14)
xy = X[class_member_mask & ~core_samples_mask]
plt.plot(xy[:, 0], xy[:, 1], 'o', markerfacecolor=col,
markeredgecolor='k', markersize=6)
plt.title('Estimated number of clusters: %d' %
n_clusters_)
plt.show()
output:

could you write a python code program using version 3 and jupyter notebook to implement DBSCAN...
Write a short python program in the Jupyter notebook using the TIPS dataset. Take a screenshot of your program as shown on your Python program. The output of your bar chart show look like the image below: 0.20 0.15 tip_rate 0.10 0.05 0.00 Sun Sat Thur Fri day It should show the tip rate on a certain weekdays as shown in the flow chart. Create a ratio column in the Dataframe and the tip rate should be calculated by dividing...
Write a Python program in this Jupyter Notebook. This program will allow a user to choose from a menu to print various text shapes includeing rectangle, triangle, and diamond as well as a set of numbers in a pattern. This program will allow the user to select the type, the size and/or the fill character for a shape. Your program will verify user inputs such as size for certain range specifications, depending on the shapes.
write a function in jupyter notebook in python that calculate the # exact derivative value of f(x) = sin^3(x) at x = 1/5
Write a python programme in a Jupyter notebook which asks the user to input the number of radioactive nuclei in a sample, the number at a later time, and the elapsed time. The programme should calculate and display the decay constant and the half-life. The decay is described by the equations: ? = ? ?−?? ?0 ?1/2 = ln (2)/? PLEASE INCLUDE COMMENTS ON CODE. THANKS
Write a program in jupyter notebook to sum the following series: 1/3 + 3/5 + 5/7 + 7/9 + 11/9 + ....+ 95/97 + 97/ 99
write a python program Implement a “bouncing” bubble sort algorithm. In this version if bubble sort, instead of making passes through a list that starts at the beginning andirons through to the end, you should reverse the direction each pass.That is , if the first pass starts at the beginning of the list and runs through to the end, the second pass out run from the end of the list back to the beginning and then the third pass would...
Install Python, PyTorch, and Jupyter Lab on your computer. Download source code from Deep Learning with PyTorch's Web site. Run jupyter notebook on code in pich3 and submit the screen shots (both jupyter server and the browser display). Can I have step in step on how to do this I’m very confused and finished picture would be fine
In python, Write short programs (notebook cells) showing how to create & use the following data types: Tuples Ints Floats Dictionaries Sets Numpy array The programming details are provided in a separate Jupyter notebook file
1) Write a Python program that prompts the user to enter the current month name and prints the season for that month. Hint: If the user enters March, the output should be "Spring"; if the user enters June, the output should be "Summer". 2 )Write a Python program using the recursive/loop structure to print out an equilateral triangle below (double spacing and one space between any two adjacent asterisks in the same row). * * * * *...
Jupyter code (PYTHON)
True error Write a function called trueError that takes the following inputs: • X, the new value • Xtrue, the previous value And returns the following output: • error, the calculated relative error The formula for the relative error is shown below: errue = 11100% In (): def trueError(x,xtrue): # YOUR CODE HERE raise Not ImplementedError() In (): # You can call and test your function here # YOUR CODE HERE raise Not ImplementedError()