Unsupervised Machine Learning

You are currently auditing this course.
1 / 3

You are given an array of points of size 300x2 in the file /cxldata/mltut/points.csv in CSV format.

Each row in this file gives the (x, y) coordinates of a point on a map. Make a scatter plot of these points as per the instructions given below, and use the scatter plot to guess how many clusters there are.

INSTRUCTIONS

1. Load CSV Data

Given a CSV file in the folder /cxldata/mltut/points.csv. You can load as a DataFrame in the notebook using pandas using the following way:

import pandas as pd
pointsdf = pd.read_csv("/cxldata/mltut/points.csv");

Now, convert it into a numpy array

import numpy as np
points = np.array(pointsdf)

2. Extract the X and Y

Create an array called xs that contains the values of points[:,0] - that is, column 0 of points.

 your code comes here

Create an array called ys that contains the values of points[:,1] - that is, column 1 of points.

 your code comes here

3. Plot using matplotlib

You can import it in the following way:

import matplotlib.pyplot as plt

Make a scatter plot by passing xs and ys to the plt.scatter() function. Call the plt.show() function to show your plot.

 your code comes here

How many clusters do you see?

See Answer

No hints are availble for this assesment

Loading comments...