Last active
January 26, 2019 07:33
-
-
Save ashunigion/bdc11d950a879a440181a39d7c6c6e23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the following code snippet was provided by UCSD for Machine Learning Fundamentals on edX | |
@interact_manual( M=(100,2000,100), rounds=(1,10)) | |
def comparison(M,rounds): | |
""" | |
Shows the mean error of both the prototyping methods. As we randomly prototyping the data, | |
it makes sense to do it multiple times and take the mean error. | |
Parameters: | |
M(int): number of data points to be sampled | |
r(int): number of times random dataset chosen to calculate the mean error | |
Returns: | |
printed values of mean error by both the methods | |
""" | |
print("Comparing your prototype selection method to random prototype selection...") | |
rand_err, rand_std = mean_error(rand_prototypes, M, rounds) | |
my_err, my_std = mean_error( my_prototypes, M, rounds) | |
print;print("Number of prototypes:", M) | |
print("Number of trials:", rounds) | |
print("Error for random prototypes:", rand_err ) | |
print("Error for your prototypes:", my_err );print | |
if rand_err < my_err: | |
print("RANDOM prototypes win!") | |
else: | |
print("YOUR prototypes win!") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment