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

Please login to comment

14 Comments

import pandas as 
import numpy as np
import matplotlib.pyplot as plt


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

points = np.array(pointsdf)

xs, ys = points[:,0], points[:,1]

plt.scatter(xs, ys)
plt.show()

 

  Upvote    Share

Hi

 

I could not access the file

 

  Upvote    Share

What error are you facing?

  Upvote    Share

I am getting the Following Error

jupyter.f.cloudxlab.com took too long to respond & Lab Console is Not Working.

  Upvote    Share

Hi,

I checked from my end and it is working fine now. Could you please check once and let me know if you are still facing this issue?

Thanks.

  Upvote    Share

Its Resolve. Thankyou!

  Upvote    Share

getting this error

  Upvote    Share

Hi,

It may be due to a poor internet connection.

Thanks.

  Upvote    Share

can you please give me the pull command, steps how to pull this file?

  Upvote    Share

Hi,

This file is already there in this location, you do not need to pull it.

Thanks.

  Upvote    Share

I am getting file does not exist ...please reply

  Upvote    Share

Hi,

Would request you to share a screenshot of your code and the error that you are getting.

Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share

Hi
I have written a code as required and got the answer also i.e. three clusters but stillunable to submit.
Thanks

  Upvote    Share

Hi,

Would suggest you to restart your server using the link below and then try once again:
https://discuss.cloudxlab.c...
Thanks.

-- Rajtilak Bhattacharjee

  Upvote    Share