print("function learned is"learner predictor_string()for ecrit in evaluate all_criteriatest_error data evaluate_dataset(data testlearner predictorecritprint(average"ecrit __doc__"is"test_errorthe following plots the errors on the training and test sets as function of the number of steps of gradient descent learnlinear py -(continued def plot_steps(learner=nonedata nonecriterion=evaluate squared_lossstep= num_steps= log_scale=truelegend_label="")""plots the training and test error for learner data is the learner_class is the class of the learning algorithm criterion gives the evaluation criterion plotted on the -axis step specifies how many steps are run for each point on the plot num_steps is the number of points to plot ""if legend_label !""legend_label+=plt ion(plt xlabel("step"plt ylabel("average "+criterion __doc__if log_scaleplt xscale('log'#plt semilogx(#makes log scale elseplt xscale('linear'if data is nonedata data_from_file('data/holiday csv'num_train= target_index=- #data data_from_file('data/spect csv'target_index= data data_from_file('data/mail_reading csv'target_index=- data data_from_file('data/carbool csv'target_index=- #random seed(nonereset seed if learner is nonelearner linear_learner(datatrain_errors [test_errors [for in range( ,num_steps+ ,step)test_errors append(data evaluate_dataset(data testlearner predictorcriterion)train_errors append(data evaluate_dataset(data trainlearner predictorcriterion)learner display( "train error:",train_errors[- ]version june