Basics On IA Modeling

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Basics on IA modeling

- Important libraries and things to import:


o Pandas
 from sklearn.tree
 import DecisionTreeRegressor
 from sklearn.metrics
 import mean_absolute_error
 from sklearn.model_selection
 import train_test_split
 from sklearn.ensemble
 import RandomForestRegressor
- Steps
o Choosing data
 Basic
 y=data.Objetive
 X=data.Features
 Advanced (we can prove its efficacy later)
 train_X, val_X, train_y, val_y = train_test_split(X, y,
random_state=n)
o Setting the model
 model=DecisionTreeRegressor(random_state=n)
o Fitting the model
 model.fit(train_X, train_y)
o Doing predictions
 predictions= model.predict(val_X)
o Model validation
 mae= mean_absolute_error(val_y, predictions)

- Function to calculate error given the nodes: get_mae

You might also like