learning with uncertainty for in range(self num_classes)res +prod(fc[ ][feat(tple)][cfor ( ,featin enumerate(feats))/(cc[ ]**(len(feats)- )if res> return -math log (res/len(self dataset train)elsereturn float("inf"#infinity def plot_error(selfmaxstep= )"""plots the logloss error as function of the number of steps""plt ion(plt xlabel("step"plt ylabel("ave logloss (bits)"train_errors [if self dataset testtest_errors [for in range(maxstep)self learn( train_errors appendsum(self logloss(tplefor tple in self dataset train/len(self dataset train)if self dataset testtest_errors appendsum(self logloss(tplefor tple in self dataset test/len(self dataset test)plt plot(range( ,maxstep+ ),train_errorslabel=str(self num_classes)+classes training set"if self dataset testplt plot(range( ,maxstep+ ),test_errorslabel=str(self num_classes)+classes test set"plt legend(plt draw( def prod( )"""returns the product of the elements of ""res for in lres * return res def random_dist( )"""generate random numbers that sum to ""res [random random(for in range( ) sum(resreturn [ / for in res data data_from_file('data/emdata csv'num_train= target_index= eml em_learner(data, num_iter= version june