Computer Science  >  Research Paper  >  CS 6601 Assignment 5 Georgia Institute Of Technology (All)

CS 6601 Assignment 5 Georgia Institute Of Technology

Document Content and Description Below

#!/usr/bin/env python # coding: utf-8 # This was input cell with execution count: 1 import os import numpy as np from helper_functions import * # Please don't modify this cell # This was input ... cell with execution count: def get_initial_means(array, k): """ Picks k random points from the 2D array (without replacement) to use as initial cluster means params: array = numpy.ndarray[numpy.ndarray[float]] - m x n | datapoints x features k = int returns: initial_means = numpy.ndarray[numpy.ndarray[float]] """ newArr = array.copy() np.random.shuffle(newArr) # First shuffle up the array (so we don't need to worry about random selection) return newArr[:k] # Select k values to return # This was input cell with execution count: def dist(a, b, axis=1): """ Euclidean Distance metric """ return np.linalg.norm(a - b, axis=axis) def k_means_step(image_values, k, means): """ A single update/step of the K-means algorithm Based on a input image_values and current mean estimate calculate new means and predict clusters for each of the pixel params: image_values = numpy.ndarray[numpy.ndarray[numpy.ndarray[float]]] k = int initial_means = numpy.ndarray[numpy.ndarray[float]] returns: new_means = numpy.ndarray[numpy.ndarray[float]] clusters = numpy.ndarray[numpy.ndarray[int]] """ new_means = np.ndarray(shape=(k, len(image_values[0])), dtype=float) clusters = np.zeros(shape=len(image_values), dtype=int) meanPts = [] for i in range(k): meanPts.append( []) # For meanPts, we group all points by their corresponding cluster so we can calculate the new means eucDist = np.zeros(shape=(len(image_values), k), dtype=float) # This is for distance from each mean [Show More]

Last updated: 1 year ago

Preview 1 out of 12 pages

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)
Preview image of CS 6601 Assignment 5 Georgia Institute Of Technology document

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Reviews( 0 )

$9.00

Buy Now

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Instant download

Can't find what you want? Try our AI powered Search

274
1

Document information


Connected school, study & course


About the document


Uploaded On

Apr 10, 2021

Number of pages

12

Written in

All

Seller


Profile illustration for Muchiri
Muchiri

Member since 4 years

209 Documents Sold

Reviews Received
19
5
1
1
6
Additional information

This document has been written for:

Uploaded

Apr 10, 2021

Downloads

 1

Views

 274

Recommended For You

Get more on Research Paper »

$9.00
What is Scholarfriends

Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·