Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE ANSWER IN C++ 1. Write code to read in CSV data into an array/vector 2. Declare an array/vector that represents the predicted labels 3.

PLEASE ANSWER IN C++

1. Write code to read in CSV data into an array/vector 2. Declare an array/vector that represents the predicted labels 3. Run each sample through our expert system and save the predicted label 4. Compute the # Correct as the number of predicted labels that match the ground truth 5. Display the resulting labels 6. Print out the percent correct to the console

CSV File

1.4 1 1.5 1 1.5 1 1.3 1 1.5 1 1.3 1 1.6 1 1 1 1.3 1 1.4 1 1 1 1.5 1 1 1 1.4 1 1.3 1 1.4 1 1.5 1 1 1 1.5 1 1.1 1 1.8 1 1.3 1 1.5 1 1.2 1 1.3 1 1.4 1 1.4 1 1.7 1 1.5 1 1 1 1.1 1 1 1 1.2 1 1.6 1 1.5 1 1.6 1 1.5 1 1.3 1 1.3 1 1.3 1 1.2 1 1.4 1 1.2 1 1 1 1.3 1 1.2 1 1.3 1 1.3 1 1.1 1 1.3 1 2.5 2 1.9 2 2.1 2 1.8 2 2.2 2 2.1 2 1.7 2 1.8 2 1.8 2 2.5 2 2 2 1.9 2 2.1 2 2 2 2.4 2 2.3 2 1.8 2 2.2 2 2.3 2 1.5 2 2.3 2 2 2 2 2 1.8 2 2.1 2 1.8 2 1.8 2 1.8 2 2.1 2 1.6 2 1.9 2 2 2 2.2 2 1.5 2 1.4 2 2.3 2 2.4 2 1.8 2 1.8 2 2.1 2 2.4 2 2.3 2 1.9 2 2.3 2 2.5 2 2.3 2 1.9 2 2 2 2.3 2 1.8 2

EXPERT SYSTEMS.cpp

#include #include #include #include /* * Function that reads data from a CSV into a 2-D array. */ template void readCSV(double(&array)[rows][cols], char* filename) { std::ifstream file(filename); for (size_t row = 0; row < rows; ++row) { std::string line; std::getline(file, line); if (!file.good()) break; std::stringstream iss(line); for (size_t col = 0; col < cols; ++col) { std::string val; std::getline(iss, val, ','); std::stringstream convertor(val); convertor >> array[row][col]; } } } /* * Function that displays data values */ template void displayValues(double(&array)[rows][cols]) { for (int row = 0; row < rows; ++row) { for (int col = 0; col < cols; col++) { std::cout << array[row][col] << ' '; } std::cout << std::endl; } } int main(int argc, char* argv[]) { // Your code here // Use readCSV to create data array // displayValues // for loop which classifies each element in array using if statement // compare predicted class with groundtruth. return 0; }

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_2

Step: 3

blur-text-image_3

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

Pro SQL Server Administration

Authors: Peter Carter

1st Edition

1484207106, 9781484207109

More Books

Students also viewed these Databases questions