Lesson 3: Your first machine learning model Flashcards
How do you find out a list of column headings of a DataFrame?
That is done with the columns property of the DataFrame (the bottom line of code below)
e.g. melbourne_data.columns
How do you drop rows of data with missing values?
melbourne_data = melbourne_data.dropna(axis=0)
The column we want to predict is called the p—– t—-
prediction target
By convention, the prediction target is called -
y
The columns that are inputted into our model (and later used to make predictions) are called f——
features
By convention, the features data is called…
X
How do you see a sample of the the first few rows of a DataFrame (“X”)?
X.head()
S—-L—– is easily the most popular library for modeling the types of data typically stored in DataFrames
Scikit-learn
Why define a number for random_state?
Specifying a number for random_state ensures you get the same results in each run.
4 basic steps for building and using a model
- Define: What type of model will it be? A decision tree? Some other type of model? Some other parameters of the model type are specified too.
- Fit: Capture patterns from provided data. This is the heart of modeling.
- Predict: Just what it sounds like
- Evaluate: Determine how accurate the model’s predictions are.
How do you import a Decision Tree model?
from sklearn.tree import DecisionTreeRegressor