Page 130 - Artificial Intellegence_v2.0_Class_12
P. 130
. sing the sample of model evaluation scores, summarise the model's ability.
est Data raining data
Iteration
Iteration
Iteration
•
•
•
Iteration k
All data
Experiential Learning
Video Session
can the code or visit the follo ing link to atch the video old ross alidation Intro to
achine earning
https .youtube.com atch v Igf mp A
After atching the video, ans er the follo ing question
hat is the role of cross validation during testing of an AI model
T r ain T est S plit V s C r oss- V alidation
he increased computational load of doing cross validation isn't a ma or concern on small datasets. ith a train test
split, these are also the problems here model quality scores ould be the least trust orthy. ross validation should be
used if your dataset is small.
or the same reasons, for larger datasets, a simple train test split is sufficient. It ill run faster, and you may have enough
data that reusing a portion of it for a train test split is unnecessary.
ross validation is mostly the method of choice since it allo s your model to be trained on multiple train test splits.
his gives a good idea of ho ell your model ill perform on data not seen before. On the other hand, rain est plit
procedure relies on only one train test split.
Ex amples f r om small datasets- - scaled up to C apstone Pr oj ect
Python code to implement simple linear regression
f r om sk lear n.mod el_ selection imp or t tr ain_ test_ sp lit
f r om sk lear n.linear _ mod el imp or t L inear Regr ession
f r om sk lear n.metr ics imp or t mean_ sq u ar ed _ er r or
imp or t nu mp y as np
# Samp le d ata: f er tiliz er amou nt ( X ) and cr op y ield ( y )
X = np .ar r ay ( [ [ 2 ] , [ 4 ] , [ 6 ] , [ 8 ] , [ 1 0 ] , [ 1 2 ] , [ 1 4 ] , [ 1 6 ] , [ 1 8 ] , [ 2 0 ] ] )
y = np .ar r ay ( [ 5 , 7 , 8 , 1 0 , 1 2 , 1 3 , 1 5 , 1 7 , 1 8 , 2 0 ] )
Touchpad Artificial Intelligence (Ver. 2.0)-XII

