The public sample script selects soybean records from Paraná in the processed PSR history.
UNICAMP research
Learning to decide under constraints.
My master's research explored reinforcement learning for fraud prevention in crop insurance—connecting statistical signals, sequential decisions and a limited budget.
Master's in Digital Agriculture
UNICAMP · Campinas · 2021–2023

The research question
How should a policy make a sequence of insurance decisions when each choice changes the remaining budget?
The thesis brought together my interests in economics, machine learning and decision-making. The public gym-insurance repository contains InsurEnv, an experimental environment for studying insurance-claim decisions with reinforcement learning.
- Supervisor
- Stanley Robson de Medeiros Oliveira
- Research line
- Data Science · FEAGRI / UNICAMP · 2023
- Thesis title
- Reinforcement Learning Applied to Fraud Prevention for Crop Insurance
The experiment, at a glance
A claim is also a choice about what comes next.
Approving one claim uses resources that are no longer available for the next. I explored this as a sequence of decisions: observe a case, choose an action, update the budget, and learn from the resulting signal.
The environment represents approval and rejection, with a wallet tracking the budget and decision history.
Budget used, approval ratio, and Benford distances with and without the latest selected case supplement the claim features.
A closer look at the statistical signal
Why look at the digits?
Benford’s law describes a pattern in the leading digits of many naturally occurring numerical datasets. Smaller leading digits are more common. The experiment uses distance from a Benford distribution as part of its reward design.
This first-digit chart explains the idea. The implementation uses a three-digit Benford-distance calculation. These are theoretical probabilities, not measured insurance data or research results.
P(d) = log₁₀(1 + 1/d)
What this work contributes
Economics, statistics and learning in one decision environment.
The contribution is an inspectable experimental setup: data preparation, a budget-aware environment, a statistical reward and a DQN learning agent. It makes the assumptions behind sequential insurance decisions explicit.
Compare policies
The repository includes random-agent comparisons and DQN experiments, making a baseline part of the research design.
Read the trade-offs
Reward, budget consumption and approval history describe different aspects of the policy. They need to be interpreted together.
Establish real-world validity
Confirmed fraud labels and independent evaluation are needed before drawing conclusions about detection performance.
Try the decision problem
One budget. A sequence of choices.
A short, synthetic illustration of the budget constraint. You choose the actions; no trained agent or fraud prediction is running here.
Conceptual notation: claim features, budget, approval history and statistical distances form the state. The policy seeks cumulative reward; this is not a measured performance result.
Inside the research
From data to a decision policy.
Prepare the insurance data
The repository includes data-preparation scripts and a sample selection for soybean insurance in Paraná, Brazil.
Represent the decision environment
InsurEnv combines claim features, budget usage, approval history and statistical signals in a Gym-style environment with two actions.
Define the learning signal
The environment's reward compares Benford-distance measures for selected claim values. A wallet component tracks decisions and the available budget.
Study a learned policy
The public code includes a TensorFlow/Keras Deep Q-Network agent with experience replay, a target network and exploration, alongside scripts for random-agent comparisons and experiment analysis.
Read the implementation
Research you can inspect.
Research prototype. The source links document the experimental design; no reproduced benchmark or production result is presented here.
Beyond the code
A personal chapter in a technical journey.
These photographs bring the university and the defense day into the story behind the work.


Earlier research · PUC-SP
Foreign direct investment in Brazil
Two stages of research at PUC-SP: an undergraduate research project, followed by a final thesis that revisited the topic with updates and a different model.
Explore the FDI research ↗