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

 * Load the binary file, filename into a Dataset and returna pointer to * the Dataset. The binary file format is as

* 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

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!