text: # summarize class balance from the har dataset
  from numpy import vstack
  from pandas import read_csv
  from pandas import DataFrame
  
  # load a single file as a numpy array
  def load_file(filepath):
  	dataframe = read_csv(filepath, header=None, delim_whitespace=True)
  	return dataframe.values
  
  # summarize the balance of classes in an output variable column
  def class_breakdown(data):
  	# convert the numpy array into a dataframe
  	df = DataFrame(data)
  	# group data by the class value and calculate the number of rows
  	counts = df.groupby(0).size()
  	# retrieve raw rows
  	counts = counts.values
  	# summarize
  	for i in range(len(counts)):
  		percent = counts[i] / len(df) * 100
  		print('Class=%d, total=%d, percentage=%.3f' % (i+1, counts[i], percent))
  
  # load train file
  trainy = load_file('HARDataset/train/y_train.txt')
  # summarize class breakdown
  print('Train Dataset')
  class_breakdown(trainy)
  
  # load test file
  testy = load_file('HARDataset/test/y_test.txt')
  # summarize class breakdown
  print('Test Dataset')
  class_breakdown(testy)
  
  # summarize combined class breakdown
  print('Both')
  combined = vstack((trainy, testy))
  class_breakdown(combined)