Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sample Output: def calculate_centroid_pos (data): (5 pts) function receives a 2D numpy array data (N x M dimensions) and calculates the new updated centroid position

image text in transcribed

Sample Output:

image text in transcribed

def calculate_centroid_pos (data): (5 pts) function receives a 2D numpy array "data" (N x M dimensions) and calculates the new "updated" centroid position for these data Note: assume all the the examples given in "data" belong to one cluster function should return a numpy array with 1xM dimensions (centroid position). Parameters: data: 2D numpy array (N X M dim) with continuous numerical values. Returns: The numpy array with 1xM dimensions of the centroid: one centroid position in M dimensions. In [15]: mydata np.array( [ [1, 2], [3, 4], [5, 6] ]) In [16]: hw.calculate_centroid_pos(mydata) Out[16]: array([3., 4. ]) In [17]: # Now testing higher dimensions In [18]: mydata = np.array([ [ 1, 2, 3], [4, 5, 6], [7, 8, 9] 1) In [19]: hw.calculate_centroid_pos (mydata) Out[19]: array([4., 5., 6.])

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions

Question

What metaphors might describe how we work together?

Answered: 1 week ago

Question

3. Evaluate a Web-based training site.

Answered: 1 week ago