# TEST Training, validation, and test sets (1e) Test. imshow ( dataValues, interpolation = 'nearest', aspect = 'auto', cmap = cm. 5, 49, 1 ), figsize = ( 8, 7 ), hideLabels = True, gridColor = '#eeeeee', gridWidth = 1.1 ) image = plt. set_visible ( False ), ) return fig, ax # generate layout and plot fig, ax = preparePlot ( np. grid ( color = gridColor, linewidth = gridWidth, linestyle = '-' ) map ( lambda position : ax. set_color ( '#999999' ) if hideLabels : axis. tick_params ( labelcolor = '#999999', labelsize = '10' ) for axis, ticks in : axis. subplots ( figsize = figsize, facecolor = 'white', edgecolor = 'white' ) ax.
toArray (), parsedSampleMorePoints ) def preparePlot ( xticks, yticks, figsize = ( 10.5, 6 ), hideLabels = False, gridColor = '#999999', gridWidth = 1.0 ): """Template for generating the plot layout.""" plt. # sampleMorePoints = rawData.takeSample(False, 50) parsedSampleMorePoints = map ( parsePoint, sampleMorePoints ) dataValues = map ( lambda lp : lp. Note that you should run this cell with the line commented # out when answering the lab quiz questions. These will be randomly # selected each time you run the cell. take ( 50 ) # You can uncomment the line below to see randomly selected features. Import matplotlib.pyplot as plt import matplotlib.cm as cm sampleMorePoints = rawData. Note that, for reference, you can look up the details of the relevant Spark methods in Spark's Python API and the relevant NumPy methods in the NumPy Reference ¶
Our goal is to train a linear regression model to predict the release year of a song given a set of audio features.
Linear Regression Lab ¶ This lab covers a common supervised learning pipeline, using a subset of the Million Song Dataset from the UCI Machine Learning Repository.