July 2019
Beginner to intermediate
740 pages
16h 52m
English
Before we can build our model, we must isolate the columns that are used to predict (semimajoraxis, mass, and eccentricity) from the column that will be predicted (period):
>>> data = planets[... ['semimajoraxis', 'period', 'mass', 'eccentricity']... ].dropna()>>> X = data[['semimajoraxis', 'mass', 'eccentricity']]>>> y = data.period
This is a supervised task. We want to be able to predict the length of a year on a planet using its semi-major axis, mass, and eccentricity of orbit, and we have the period lengths for most of the planets in the data. Let's create a 75/25 split of training to testing data so that we can assess how well this model predicts year length:
>>> from sklearn.model_selection ...
Read now
Unlock full access