Question: C++ code only. Stuck and could use some help/guidance. Comments would help too. MUST use these function as described: vector split(const string &s, char delim='

C++ code only. Stuck and could use some help/guidance. Comments would help too. MUST use these function as described:

vector split(const string &s, char delim=' '); void read_data(map, string> &m, unsigned int feature_count, ifstream &inf); string pair_to_string(const pair, string> &p); void print_map(const map, string> &m, ostream &out); double distance(const vector &v1, const vector &v2, unsigned int feature_count); map, string> k_neighbors(const map, string> &m, const vector &test, int k); double test_one(const map, string> &m, pair, string> test, int k); double test_all(const map, string> &m, int k); 

If these are not used the program will not work. The describtion for what each function does is found below. So PLEASE, use the functions when wrinting the code. Here is a link to the iris.data.txt and little.txt:

http://www.cse.msu.edu/~cse232/Weekly/week08/project/

C++ code only. Stuck and could use some help/guidance. Comments would helptoo. MUST use these function as described: vector split(const string &s, chardelim=' '); void read_data(map, string> &m, unsigned int feature_count, ifstream &inf); stringpair_to_string(const pair, string> &p); void print_map(const map, string> &m, ostream &out); double

CSE 232 Fall 2017 Programming Project #7 Assignment Overview This project focuses on the use of maps. It is worth 50 points (5% of your overall grade). It is due Monday 10/30 before midnight The Problem Machine learning is a common term used these days. One of the many areas where machine learning is used is in pattern recognition, specifically in the area of classifying a "thing" as to its type. This is the overall problem we are going to address today. The k-nearest neighbor classifier A relatively simple, though potentially computationally expensive, algorithm to classifying an unknowrn element in terms of known elements is called a k-nearest neighbor classifier, a knn for short. It works as follows Imagine you have two measurements you have performed on a set of objects: let's say size and cost. We call these the features of the classification problem. You plot (in 2D for two features, in higher dimensions for more features) the location of all the known objects with respect to their feature values on a graph. You also label each of the known objects as to their known class, here indicated by the colors red and blue We then place an unknown object (represented by ?), whose class we do not know, into the graph based on its features and find its k nearest neighbors, in this case k-3. The situation is shown below 73 21 72 size We can then answer the following questions as to what "class" the unknowns are based on their three nearest neighbors in the 2 feature space 71 is a "red" thing ?2 is a "blue" thing ?3 is 2/3 red and 1/3 blue Pretty easy. Computationally expensive because to find the 3-nn or 5-nn of an element we must measure the distance between the unknown and every other element in our known set, then find the 3 or 5 (depending on the value of k) closest. CSE 232 Fall 2017 Programming Project #7 Assignment Overview This project focuses on the use of maps. It is worth 50 points (5% of your overall grade). It is due Monday 10/30 before midnight The Problem Machine learning is a common term used these days. One of the many areas where machine learning is used is in pattern recognition, specifically in the area of classifying a "thing" as to its type. This is the overall problem we are going to address today. The k-nearest neighbor classifier A relatively simple, though potentially computationally expensive, algorithm to classifying an unknowrn element in terms of known elements is called a k-nearest neighbor classifier, a knn for short. It works as follows Imagine you have two measurements you have performed on a set of objects: let's say size and cost. We call these the features of the classification problem. You plot (in 2D for two features, in higher dimensions for more features) the location of all the known objects with respect to their feature values on a graph. You also label each of the known objects as to their known class, here indicated by the colors red and blue We then place an unknown object (represented by ?), whose class we do not know, into the graph based on its features and find its k nearest neighbors, in this case k-3. The situation is shown below 73 21 72 size We can then answer the following questions as to what "class" the unknowns are based on their three nearest neighbors in the 2 feature space 71 is a "red" thing ?2 is a "blue" thing ?3 is 2/3 red and 1/3 blue Pretty easy. Computationally expensive because to find the 3-nn or 5-nn of an element we must measure the distance between the unknown and every other element in our known set, then find the 3 or 5 (depending on the value of k) closest

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!