Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Apply an expert system IN C++ 1. Write code to read in CSV data into an array/vector 2. Declare an array/vector that represents the predicted

Apply an expert system 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

Code given:

#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

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books