scieee Science in your language
[en] (orig)

Crop Recommendation Model Using Machine Learning

Author: Dr. Emmanuel N.; Gabriel N.; Gad R.; Bwiza D.; Manzi J. K.; Kennet C.
Publisher: Zenodo
DOI: 10.5281/zenodo.17734886
Source: https://zenodo.org/records/17734886/files/11.pdf
In e na ional Jou nal o Li e Science and Ag icul u e Resea ch
ISSN (P in ): 2833-2091, ISSN (Online): 2833-2105
Volume 04 Issue 11 No embe 2025
DOI: h ps://doi.o g/10.55677/ijlsa /V04I11Y2025-11
Impac Fac o : 7.88 , Page No : 707-714
www.ijlsa .o glable a : iA a 147| 707 P a g e
C op Recommenda ion Model Using Machine Lea ning
D . Emmanuel N.1, Gab iel N.1, Gad R.1, Bwiza D.1, Manzi J. K.1, Kenne C.2
1Ca negie Mellon Uni e si y - A ica
2Kum a Insigh s L d
ABSTRACT
Rwanda’s ag icul u e sec o plays a c i ical ole in he coun y’s economy, bu a me s o en ace
challenges in selec ing he mos sui able c ops o hei ields due o ecommenda ion p ac ices
ha ocus p ima ily on soil nu ien analysis and neglec impo an ac o s such as clima e
a iabili y and geog aphic al i ude. This s udy p esen s he de elopmen o a da a-d i en c op
ecommenda ion sys em designed o add ess hese limi a ions by using a ious da a sou ces
including soil es esul s, his o ical and o ecas wea he pa e ns, and c op-speci ic
equi emen s, wi h machine lea ning algo i hms applied o gene a e cus omized c op
ecommenda ions. While XGBoos achie ed he highes accu acy a 98.25%, he Random Fo es
model, which achie ed an accu acy o 96.7%, was selec ed o deploymen because i s be e
balance be ween p ecision and ecall helps minimize he isk o esou ce ine iciencies om
inco ec ecommenda ions, and i s mo e e enly dis ibu ed ea u e impo ance enhances
gene alizabili y ac oss di e se a ming condi ions. The inal model was in eg a ed in o a scalable
analy ics pla o m o ensu e usabili y and impac , demons a ing how combining ad anced da a
analy ics wi h machine lea ning can enhance decision-making in ag icul u e, suppo sus ainable
a ming p ac ices, and imp o e yields in Rwanda.
KEYWORDS: Nu ien s, p edic i e modeling, seasonal da a, c op yield.
Published Online:
No embe 27, 2025
Co esponding Au ho :
D . Emmanuel N.
INTRODUCTION
Ag icul u e emains a co ne s one o Rwanda’s economy, employing app oxima ely 64.5% o he popula ion and con ibu ing abou
a qua e o he na ional GDP (Qu & Hao, 2018). Smallholde a me s accoun o mo e han 80% o o al ag icul u al p oduc ion,
unde sco ing hei cen al ole in ensu ing ood secu i y and d i ing sus ainable u al de elopmen (Musabanganji e al., 2019).
Despi e his impo ance, he sec o con inues o ace pe sis en challenges, including limi ed access o mode n echnologies,
agmen ed ag icul u al da a, and inc easing clima e a iabili y. These issues cons ain p oduc i i y and h ea en he long- e m
esilience o a ming sys ems, making i essen ial o de elop inno a i e app oaches ha suppo in o med ag icul u al decision-
making (Can o e, 2012).
Globally, ag icul u e employed an es ima ed 892 million people o e a qua e o he wo ld’s wo k o ce in 2022, and ag i ood
sys ems suppo ed mo e han 1.3 billion jobs in 2021 (FAO, 2024). Ye global ag icul u e is also bu dened by challenges such as
clima e change, unp edic able wea he pa e ns, and esou ce sca ci y, which disp opo iona ely impac smallholde a me s (Cui e
al., 2018). Limi ed access o c i ical esou ces and mode n echnologies o en exace ba es a me s’ ulne abili y o c op ailu es,
educed yields, and economic ins abili y.
Ad ancemen s in da a-d i en echnologies, especially machine lea ning (ML), p esen ans o ma i e oppo uni ies o add essing
hese cons ain s. ML enables he in eg a ion and analysis o complex da ase s including soil composi ion, en i onmen al condi ions,
and mul isou ce clima e in o ma ion o gene a e ac ionable insigh s ha enhance decision-making in ag icul u e (Modi e al., 2021).
ML-powe ed sys ems ha e p o en capable o ecommending app op ia e c ops, p edic ing yields, and imp o ing esou ce e iciency
h ough da a-d i en guidance (Tuyize e e al., 2024). Howe e , many exis ing c op ecommenda ion sys ems ely p ima ily on basic
soil es inpu s while o e looking essen ial ac o s such as clima e a iabili y, geog aphic al i ude, and localized en i onmen al
dynamics (Modi e al., 2021). This na ow ocus limi s he accu acy and ele ance o ecommenda ions, pa icula ly in egions
cha ac e ized by di e se ag oecological condi ions like Rwanda.
D . Emmanuel N. e al, C op Recommenda ion Model Using Machine Lea ning
www.ijlsa .o glable a : iA a 14 7| 708 P a g e
To add ess hese gaps, his esea ch de elops a machine lea ning–based c op ecommenda ion sys em ailo ed o Rwanda’s unique
en i onmen al landscape. The sys em in eg a es mul iple da ase s, including soil cha ac e is ics, al i ude-based in o ma ion, and
bo h his o ical and o ecas wea he pa e ns, oge he wi h c op-speci ic equi emen s. By le e aging ad anced ML algo i hms
wi hin a scalable analy ics pla o m, he sys em aims o gene a e localized and eliable c op ecommenda ions ha empowe a me s,
enhance p oduc i i y, and s eng hen esilience o clima e- ela ed isks. Beyond immedia e c op selec ion suppo , he pla o m
aligns wi h b oade e o s o mode nize ag icul u e h ough da a-d i en app oaches ha p omo e sus ainabili y, ood secu i y, and
e icien esou ce use (Kabi igi e al., 2017; Kuma e al., 2021; Cyemezo e al., 2019).
MATERIALS AND METHODS
Modeling App oach
An Agile de elopmen me hodology was adop ed o suppo i e a i e implemen a ion, con inuous es ing, and adap i e e inemen
o he c op ecommenda ion sys em. This app oach allowed eedback-d i en imp o emen s a each s age o he de elopmen cycle,
ensu ing ha sys em pe o mance aligned wi h use equi emen s and p ojec objec i es.
Sys em Requi emen s
Py hon was used as he p ima y p og amming language due o i s ex ensi e ecosys em o da a analysis and machine lea ning.
Jupy e No ebooks acili a ed explo a o y analysis and model p o o yping, while Fas API enabled deploymen and in eg a ion o
he inal model in o he Kum a Insigh s analy ics pla o m. Gi Hub was used o e sion con ol and collabo a i e code managemen .
A summa y o key lib a ies and packages is p esen ed in Table 1.
TABLE 1: Lib a ies/Packages
Ca ego y
Lib a y / Module
Pu pose
Da a Manipula ion and
Analysis
pandas, NumPy
Da a manipula ion and nume ical
ope a ions
Visualiza ion
seabo n, ma plo lib.pyplo
Visualiza ion o da a and model
pe o mance
P ep ocessing
LabelEncode , S anda dScale , MinMaxScale , SimpleImpu e
Encoding, scaling, and impu ing
missing da a
S a is ical Analysis
scipy.s a s
Pe o ming s a is ical es s and
analyses
Model T aining and
E alua ion
ain_ es _spli , S a i iedShu leSpli , S a i iedKFold,
c oss_ al_sco e, accu acy_sco e, classi ica ion_ epo
Spli ing da a, c oss- alida ion, and
e alua ing model pe o mance
Machine Lea ning
Models
RandomFo es Classi ie , DecisionT eeClassi ie , SVC,
XGBClassi ie , GaussianNB
Machine lea ning algo i hms o
classi ica ion
U ili y
da e ime, joblib, json
Sa ing models, handling da es, and
managing JSON da a
Da a Collec ion
To ensu e a comp ehensi e and eliable da a se , his p ojec used bo h in e nal and ex e nal da a sou ces:
1) Kum a Insigh s Da ase : The in e nal da ase included de ailed soil, clima e, and geog aphic da a speci ic o Rwanda.
2) Ex e nal Sou ces: Addi ional da a, such as wea he pa e ns and geog aphic ea u es, was sou ced om eliable pla o ms
like Google API.
The da a collec ed ocused on wo p ima y aspec s:
1) C op Sui abili y Da a: Comp ehensi e in o ma ion on ea u es and condi ions equi ed o op imal c op g ow h.
2) Regional Fea u e Values: Da a ep esen ing speci ic soil, clima e, and en i onmen al cha ac e is ics ac oss Rwanda’s
sec o s.
The da a se inco po a ed 22 c op ypes, selec ed o hei p ominence in Rwandan ag icul u e, ensu ing ele ance and u ili y o
local a me s.
Explo a o y Da a Analysis
Explo a o y analysis was conduc ed o unde s and ela ionships among clima ic a iables, soil cha ac e is ics, and c op
equi emen s. Tempe a u e ole ance anges we e examined using box plo s o di e en ia e hea -sensi i e and hea - ole an c ops,
which suppo s clima e-based ecommenda ion logic.
D . Emmanuel N. e al, C op Recommenda ion Model Using Machine Lea ning
www.ijlsa .o glable a : iA a 14 7| 709 P a g e
Fig. 1(Tempe a u e ange by c op)
A co ela ion ma ix was also gene a ed o assess in e ac ions among key soil and clima e a iables (Figu e 2). Addi ionally, a ada
cha isualized nu ien and pH p e e ences ac oss c ops, helping iden i y edaphic simila i ies and clus e s use ul o classi ica ion
(Figu e 3).
Fig. 2(Co ela ion ma ix o key ea u es)
D . Emmanuel N. e al, C op Recommenda ion Model Using Machine Lea ning
www.ijlsa .o glable a : iA a 14 7| 710 P a g e
Fig. 3(Soil cha ac e is ics by c op)
Fea u e Selec ion and Impo ance Analysis
Fea u es in luencing c op sui abili y we e g ouped in o ou majo ca ego ies:
1) C op-Speci ic Fac o s: C op ype, g ow h du a ion, and wa e equi emen s.
2) Soil and En i onmen al Fac o s: Tempe a u e, al i ude, pH, humidi y, and soil ype.
3) Soil Nu ien s: Concen a ions o ni ogen (N), phospho us (P), and po assium (K).
4) Seasonal Va iables: Plan ing and ha es ing mon hs o Rwanda’s Seasons A and B.
Fea u e impo ance was assessed using he Random Fo es algo i hm. The op en in luen ial ea u es included g owing pe iod,
nu ien le els (N and P), c op wa e needs, and empe a u e- ela ed a iables (Figu e 4).
Fig. 4(Top 10 mos impo an ea u es)
Da a P ep ocessing
Raw da a unde wen se e al p ep ocessing s eps o p epa e hem o modeling:
1) Da a Cleaning: Remo al o duplica es, co ec ion o inconsis encies, and impu a ion o missing alues.
2) Encoding: Con e sion o ca ego ical a iables (e.g., soil ype) in o nume ical o ma s.
3) Scaling: S anda diza ion o nume ical alues such as empe a u e and nu ien le els.
4) Fea u e Selec ion: Re en ion o he mos ele an a iables based on impo ance sco es and ag onomic ele ance.
D . Emmanuel N. e al, C op Recommenda ion Model Using Machine Lea ning
www.ijlsa .o glable a : iA a 14 7| 711 P a g e
Fea u e Enginee ing
Addi ional domain-speci ic ea u es we e enginee ed o imp o e model pe o mance:
1) Seasonal Timing Va iables: Op imal plan ing and ha es ing windows.
2) Al i ude-Adjus ed Clima e Me ics: Tempe a u e and humidi y adjus ed o ele a ion di e ences.
3) Soil Fe ili y Index: Composi e indica o de i ed om N, P, and K le els.
These enginee ed ea u es imp o ed he model’s gene alizabili y ac oss Rwanda’s di e se ag oecological zones.
Model A chi ec u e
The model a chi ec u e ollowed a s uc u ed pipeline ha included da a p ep ocessing, ea u e enginee ing, algo i hm aining,
pe o mance e alua ion, and inal deploymen . A simpli ied a chi ec u e is shown in Figu e 5.
Fig. 5(Model A chi ec u e o he C op Recommenda ion Sys em)
Model T aining and E alua ion
Fi e machine lea ning algo i hms we e e alua ed:
1) Decision T ee
2) Random Fo es
3) Naï e Bayes
4) XGBoos
5) Suppo Vec o Machine (SVM)
RESULTS
The c op ecommenda ion model was e alua ed using accu acy, p ecision, ecall, and F1-sco e ac oss se e al machine lea ning
algo i hms. Model pe o mance was assessed on a da ase con aining soil, clima e, and en i onmen al a ibu es ele an o c op
selec ion in Rwanda.
Model Pe o mance Compa ison
The e ec i eness o each algo i hm was analyzed o iden i y he bes -pe o ming model o c op sui abili y p edic ion. Table 2
summa izes he accu acy and de ining cha ac e is ics o all es ed models.

D . Emmanuel N. e al, C op Recommenda ion Model Using Machine Lea ning
www.ijlsa .o glable a : iA a 14 7| 712 P a g e
Table 2. Model Pe o mance Compa ison
Model
Cha ac e is ics
Accu acy (%)
Naï e Bayes
Assumes ea u e independence; s uggles wi h co ela ed a ibu es
85.3
XGBoos
Cap u es complex pa e ns; handles nonlinea ela ionships e ec i ely
98.25
Random Fo es
Robus ensemble o decision ees; educes o e i ing
96.7
Decision T ee
Simple and in e p e able; p one o o e i ing wi hou p uning
91.2
SVM
Finds op imal decision bounda y; sensi i e o ou lie s
94.8
XGBoos achie ed he highes accu acy (98.25%), e lec ing i s s ong abili y o model complex dependencies among en i onmen al
a iables. Random Fo es ollowed closely wi h 96.7%, bene i ing om ensemble lea ning ha s abilizes p edic ions. In con as ,
simple models such as Naï e Bayes and Decision T ee demons a ed lowe accu acy, p ima ily due o ea u e co ela ion issues
and suscep ibili y o o e i ing.
P ecision and Recall Analysis
P ecision and ecall compa isons ein o ced he supe io p edic i e s eng h o XGBoos . I s abili y o model nonlinea in e ac ions
and iden i y sub le pa e ns con ibu ed o high ecall and eliable iden i ica ion o sui able c ops. Howe e , XGBoos ’s sensi i i y
o noise occasionally esul ed in bo de line misclassi ica ions, which may a ec p ac ical deploymen .
Random Fo es demons a ed a mo e balanced ade-o be ween p ecision and ecall, making i a eliable op ion o eal-wo ld use
whe e inco ec ecommenda ions can incu signi ican esou ce losses. Mo eo e , Random Fo es p oduced mo e e enly dis ibu ed
ea u e impo ance sco es, educing dependence on any single a iable and imp o ing gene alizabili y ac oss Rwanda’s di e se
ag oecological zones.
Naï e Bayes pe o med less e ec i ely due o i s assump ion o independen ea u es, which is unsui able o highly co ela ed
ag onomic da a.
Random Fo es ’s balance o in e p e abili y, compu a ional e iciency, and s abili y ac oss da ase s ul ima ely con ibu ed o i s
selec ion o deploymen .
Use In e ace
A use - iendly web-based in e ace was de eloped o demons a e and es c op ecommenda ions o a me s and ag icul u al
s akeholde s. Figu e 6 illus a es he sys em in e ace and i s p edic ion unc ionali y.
The in e ace allows use s o selec hei loca ion h ough a hie a chical menu o Rwanda’s adminis a i e di isions (dis ic and
sec o ) and speci y a plan ing da e. This s eamlined p ocess enables he model o inco po a e loca ion-speci ic soil and clima e
in o ma ion wi hou equi ing a me s o p o ide echnical measu emen s. Fo example, when es ed using Kayonza Dis ic ,
Muka ange Sec o , wi h a plan ing da e o Janua y 1, 2025, he sys em gene a ed sui abili y sco es o mul iple c ops. Tea eme ged
as he op ecommenda ion wi h a sui abili y sco e o 100%, ollowed by Co ee (98.35%) and Cele y (88.60%). These ou pu s align
wi h es ablished ag icul u al pa e ns in Rwanda’s Eas e n P o ince, whe e ea and co ee a e widely cul i a ed. The iden i ica ion
o cele y as a sui able al e na i e highligh s he sys em’s capaci y o ecommend di e si ica ion op ions ha may no be immedia ely
e iden o a me s.
O e all, he in e ace combines simplici y wi h analy ical igo , suppo ing p ac ical decision-making e en among use s wi h limi ed
echnical expe ise.
D . Emmanuel N. e al, C op Recommenda ion Model Using Machine Lea ning
www.ijlsa .o glable a : iA a 14 7| 713 P a g e
Fig. 6(Use In e ace)
DISCUSSION
Random Fo es was selec ed o deploymen due o i s obus ness, balanced p ecision- ecall pe o mance, and supe io
gene alizabili y ac oss a ied en i onmen al condi ions. Al hough XGBoos achie ed he highes accu acy, Random Fo es o e ed
mo e e icien pe o mance o eal- ime, scalable deploymen . XGBoos demons a ed he s onges p edic i e capabili y (98.25%
accu acy) bu was mo e compu a ionally in ensi e and sensi i e o noisy inpu s, dec easing i s sui abili y o ope a ional use in e
sou ce-cons ained en i onmen s. Naï e Bayes eco ded he lowes accu acy (85.3%) because i s assump ion o ea u e
independence does no hold o ag onomic da ase s, which con ain co ela ed soil and clima e a iables. SVM and Decision T ee
pe o med mode a ely well, bu we e ou pe o med by ensemble models. Decision T ee was pa icula ly p one o o e i ing, while
SVM showed sensi i i y o ou lie s. O e all, he esul s indica e ha while ad anced models such as XGBoos excel in accu acy,
Random Fo es p esen s he op imal balance o pe o mance, in e p e abili y, speed, and deploymen easibili y o Rwanda’s c op
ecommenda ion needs.
CONCLUSION
This s udy demons a es he e ec i eness o machine lea ning in op imizing c op ecommenda ions o Rwanda. By in eg a ing
en i onmen al, soil, and clima ic ac o s, he sys em p o ides da a-d i en insigh s o smallholde a me s. Random Fo es was
selec ed o deploymen due o i s s ong pe o mance and in e p e abili y, while simple models s uggled wi h co ela ed ea u es.
The model enables eal ime, loca ion-speci ic ecommenda ions, imp o ing accessibili y o a me s. This esea ch suppo s
clima e- esilien a ming, enhances yield op imiza ion, and s eng hens ood secu i y, highligh ing AI’s po en ial in add essing
ag icul u al challenges.
ACKNOWLEDGMENTS
The au ho s would like o exp ess hei since e g a i ude o he s a and esea che s a Kum a Insigh s L d. o p o iding access o
c i ical da ase s and echnical suppo du ing he de elopmen o he c op ecommenda ion sys em. Special hanks a e ex ended o
D . Emmanuel N. e al, C op Recommenda ion Model Using Machine Lea ning
www.ijlsa .o glable a : iA a 14 7| 714 P a g e
Ca negie Mellon Uni e si y A ica (CMU-A ica) o acili a ing he collabo a ion and p o iding guidance h oughou he p ojec .
The au ho s also app ecia e he cons uc i e eedback and men o ship om colleagues and p o esso s, which g ea ly enhanced he
s udy design, model e alua ion, and o e all quali y o he wo k. Finally, hea el hanks go o he local a me s and ag icul u al
ad iso s in Rwanda who sha ed hei p ac ical insigh s in o egional c op p ac ices, enabling he sys em o deli e accu a e and
con ex ually ele an ecommenda ions.
DISCLOSURE
I is epo ed ha no con lic s o in e es exis in his wo k. No inancial suppo o pe sonal ela ionships in luenced he s udy
design, da a collec ion, analysis, in e p e a ion, o he epo ing o esul s.
REFERENCES
1. C. Qu and X. Hao, “Ag icul u e d ough and ood secu i y moni o ing o e he ho n o a ica (hoa) om space,” 2018 7 h
In e na ional Con e ence on Ag o-geoin o ma ics (Ag o-geoin o ma ics), 08 2018.
2. “Employmen indica o s 2000–2022 (oc obe 2024 upda e),” S a is ics, 10 2024. [Online]. A ailable:
h ps://www. ao.o g/s a is ics/highligh s-a chi e/highligh s-de ail/ employmen -indica o s-2000-2022-%28sep embe -
2024-upda e%29/en
3. Z. Cui and e al., “Pu suing sus ainable p oduc i i y wi h millions o smallholde a me s,” Na u e, ol. 555, pp. 363–366,
2018.
4. D. Modi, A. V. Su agunda , V. Yala igi, and A. A a a agima h, “C op ecommenda ion using machine lea ning
algo i hm,” in 2021 5 h In e na ional Con e ence on In o ma ion Sys ems and Compu e Ne wo ks (ISCON). IEEE, 2021,
pp. 1–5.
5. D. TuYize e, V. Uwase, M. Niyonku u, G. Ndanyunzwe, M. Kabu wa e, P. Singadi, R. Uwe a, and G. Okeyo, “Ai-d i en
p ecision a ming: A holis ic app oach o enhance ood and nu i ion secu i y in a ica,” pp. 1–6, 07 2024. [Online].
A ailable: h ps://ieeexplo e.ieee.o g/s amp/ s amp.jsp? p=&a numbe =10622109
6. E. Musabanganji and O he s, “Imp o ing ag icul u al p oduc i i y in wanda,” Ag o o es y Sys ems, pp. 112–125, 2019.
7. R. Kuma and O he s, “Hyb id models o c op ecommenda ion,” Ag icul u al Compu ing, pp. 78–92, 2021.
8. A. Cyemezo and O he s, “Time-se ies o ecas ing o c op yield p edic ion using mul ilaye pe cep ons,” In e na ional
Jou nal o Scien i ic Resea ch and Publica ions, ol. 9, no. 7, pp. 22–35, July 2019.
9. N. Can o e, “The c op in ensi ica ion p og am in wanda: a sus ainabili y analysis.” [Online]. A ailable:
h ps:// ema.go . w/ ema doc/pei/Repo ODI AM.pd
10. M. Kabi igi, S. Mugambi, B. S. Musana, G. T. Ngoga, J. C. Muhu u, J. Ru ebuka, V. M. Ruganzu, I. Nzeyimana, and N.
L. Nabahungu, “Es ima ion o soil e osion isk, i s alua ion and economic implica ions o ag icul u al p oduc ion in
wes e n pa o wanda,” Jou nal o Expe imen al Biology and Ag icul u al Sciences, ol. 5, pp. 525–536, 09 2017.
11. H. Ami , “Xgboos s linea eg ession: A p ac ical guide.” [Online]. A ailable: h ps://medium.com/@heyami 10/
xgboos - s-linea - eg ession-a-p ac ical-guide-aa09a68a 12b
12. S u hi, “Unde s anding andom o es algo i hm wi h examples.” [Online]. A ailable:
h ps://www.analy ics idhya.com/blog/2021/06/ unde s anding- andom- o es /