Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

* Load the binary file, filename into a Dataset and return a pointer to * the Dataset. The binary file format is as follows: 4

image text in transcribedimage text in transcribed

* Load the binary file, filename into a Dataset and return a pointer to * the Dataset. The binary file format is as follows: 4 bytes : 'N: Number of images / labels in the file 1 byte : Image 1 label NUM_PIXELS bytes : Image 1 data (WIDTHXWIDTH) 1 byte : Image N label NUM_PIXELS bytes : Image N data (WIDTHXWIDTH) * You can set the "sx" and "sy' values for all the images to WIDTH. * Use the NUM_PIXELS and WIDTH constants defined in dectree.h Dataset *load_dataset(const char *filename) { // TODO: Allocate data, read image data / labels, return return NULL; } double gini_impurity(Dataset *data, int M, int *indices, int pixel) { int a_freq[10] = {@}, a_count 0; int b_freq[10] = {@}, b_count 0; for (int i = 0; i images[img_idx].data[pixel] labels[img_idx]]++; a_count : } else { b_freq[data->labels[img_idx]]++; b_count++; } } * Load the binary file, filename into a Dataset and return a pointer to * the Dataset. The binary file format is as follows: 4 bytes : 'N: Number of images / labels in the file 1 byte : Image 1 label NUM_PIXELS bytes : Image 1 data (WIDTHXWIDTH) 1 byte : Image N label NUM_PIXELS bytes : Image N data (WIDTHXWIDTH) * You can set the "sx" and "sy' values for all the images to WIDTH. * Use the NUM_PIXELS and WIDTH constants defined in dectree.h Dataset *load_dataset(const char *filename) { // TODO: Allocate data, read image data / labels, return return NULL; } double gini_impurity(Dataset *data, int M, int *indices, int pixel) { int a_freq[10] = {@}, a_count 0; int b_freq[10] = {@}, b_count 0; for (int i = 0; i images[img_idx].data[pixel] labels[img_idx]]++; a_count : } else { b_freq[data->labels[img_idx]]++; b_count++; } }

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

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions