def print_component_statistics_old(n_components_to_show=N_COMPONENTS_TO_SHOW): print("component statistics:\n") for i in range(n_components_to_show): print("component " + str(i) + ":") like_comp = likesByComponent[i] dislike_comp = dislikesByComponent[i] print("means: like = " + str(mean(like_comp)) + " dislike = " + str(mean(dislike_comp))) print( "medians: like = " + str(median(like_comp)) + " dislike = " + str(median(dislike_comp))) print("stdevs: like = " + str(standard_deviation(like_comp)) + " dislike = " + str( standard_deviation(dislike_comp))) print("interquartile range: like = " + str(interquartile_range(like_comp)) + " dislike = " + str( interquartile_range(dislike_comp))) print("\n")
def printComponentStatistics(): print("component statistics:\n") for i in range(N_COMPONENTS_TO_SHOW): print("component " + str(i) + ":") likeComp = likesByComponent[i] dislikeComp = dislikesByComponent[i] print("means: like = " + str(mean(likeComp)) + " dislike = " + str(mean(dislikeComp))) print("medians: like = " + str(median(likeComp)) + " dislike = " + str(median(dislikeComp))) print("stdevs: like = " + str(standard_deviation(likeComp)) + " dislike = " + str(standard_deviation(dislikeComp))) print("interquartile range: like = " + str(interquartile_range(likeComp)) + " dislike = " + str(interquartile_range(dislikeComp))) print("\n")
def print_component_statistics(all_by_components, n_components_to_show=N_COMPONENTS_TO_SHOW): print("component statistics:\n") for i in range(n_components_to_show): print("component " + str(i) + ":") comp = all_by_components[i] print("means: like = " + str(mean(comp))) print( "medians: like = " + str(median(comp))) print("stdevs: like = " + str(standard_deviation(comp))) print("interquartile range: like = " + str(interquartile_range(comp))) print("\n")
def print_component_statistics(all_by_components, n_components_to_show=N_COMPONENTS_TO_SHOW): print("component statistics:\n") for i in range(n_components_to_show): print("component " + str(i) + ":") comp = all_by_components[i] print("means: like = " + str(mean(comp))) print("medians: like = " + str(median(comp))) print("stdevs: like = " + str(standard_deviation(comp))) print("interquartile range: like = " + str(interquartile_range(comp))) print("\n")
def printComponentStatistics(): print ("component statistics:\n") for i in range(min(N_COMPONENTS_TO_SHOW, numComponents, len(likesByComponent), len(dislikesByComponent))): print ("component " + str(i) + ":") likeComp = likesByComponent[i] dislikeComp = dislikesByComponent[i] print ("means: like = " + str(mean(likeComp)) + " dislike = " + str(mean(dislikeComp))) print ( "medians: like = " + str(median(likeComp)) + " dislike = " + str(median(dislikeComp)) ) print ( "stdevs: like = " + str(standard_deviation(likeComp)) + " dislike = " + str(standard_deviation(dislikeComp)) ) print ( "interquartile range: like = " + str(interquartile_range(likeComp)) + " dislike = " + str(interquartile_range(dislikeComp)) ) print ("\n")
def test_interquartile_range(self): self.assertEqual( 53, statistics.interquartile_range( [98, 1, 45, 3, 5, 58, 9, 20, 77, 32]))
def test_interquartile_range(self): self.assertEqual(53, statistics.interquartile_range([98, 1, 45, 3, 5, 58, 9, 20, 77, 32]))