0% found this document useful (0 votes)
15 views30 pages

Project Report

Project report on ai ml python

Uploaded by

khushalhanduja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views30 pages

Project Report

Project report on ai ml python

Uploaded by

khushalhanduja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

SUMMER TRAINING REPORT

On
“FWI PREDICTION USING MACHINE LEARNING”

Submitted in partial fulfilment of the award of the degree of

Bachelor of Technology
in

Computer Engineering

Submitted by:

Khushi

8722131

Submitted To:

DEPARTMENT OF COMPUTER ENGINEERING

STATE INSTITUTE OF ENGINEERING & TECHNOLOGY, NILOKHERI

(2022-2026)
Declaration
I hereby declare that the Project report entitled "FWI Prediction Using Machine Learning"
submitted to the Department of Computer Engineering, SIET, Nilokheri in partial fulfilment of the
requirements for the award of the degree of Bachelor of Technology (Computer Engineering) is a
record of original work done by me, under the guidance and supervision of Mrs. Monika and it
has not formed the basis for the award of any Degree or other similar title to any candidate of any
University.

Date: Signature of the Candidate

Place: Khushi

CSE 5th Semester

8722131

ii
Certificate

iii
Acknowledgement
I would like to express my deepest gratitude to everyone who supported and guided me throughout this
Fire Weather Index (FWI) Prediction project. First and foremost, I extend my sincere thanks to my
mentors and faculty advisors Mrs. Monika whose insights and expertise have been invaluable in shaping
this project. Their guidance in data science and predictive modelling provided the foundation for
tackling the complexities of wildfire risk prediction. I would also like to acknowledge the creators and
researchers behind the Canadian Fire Weather Index system and the Algerian Forest dataset, as their
pioneering work and data resources were essential to the development and validation of this project.
Special thanks to my family for their continuous encouragement and support, which motivated me
throughout the project. Finally, I am grateful for the open-source community and the tools that made
this work possible, including Python, Scikit-Learn, and Flask, as well as the online resources that
fostered my learning in machine learning and data analysis. Thank you to all who contributed directly
or indirectly to the success of this project.

Khushi

CSE 5th Semester

Roll no: 8722131

iv
Abstract

Algeria is one of the Maghreb countries most affected by wildfires. The economic, environmental, and
societal consequences of these fires can last several years after the wildfire. Often, it is possible to avoid
such disasters if the detection of the outbreak of fire is fast enough, reliable, and early. The lack of
datasets has limited the methods used to predict wildfires in Algeria to the mapping risk areas, which is
updated annually. This study is the result of the availability of a recent dataset relating the history of
forest fires in the cities of Bejaia and Sidi Bel-Abbes during the year 2012.

The aim of this project is to develop a system which can perform early prediction of FWI for a patient
with a higher accuracy by combining the results of different machine learning techniques.

This project aims to predict FWI via different supervised machine learning methods including: Linear
Regression, Lasso Regression, Ridge Regression and Elastic Net Regression. This project also aims to
propose an effective technique for earlier detection of the diabetes disease using Machine learning
algorithms and end to end deployment using flask.

v
Company Profile

Physics Wallah is an Indian ed-tech platform founded by Alakh Pandey, offering high-quality,
affordable online education for students, particularly in subjects like Physics, Chemistry, and
Mathematics. Physics Wallah has expanded its educational offerings to include coding and computer
science courses, providing affordable and quality learning resources for students. The platform now
offers courses on programming languages like Python, Java, and C++, as well as data structures,
algorithms, and competitive coding. With its clear and engaging teaching style, Physics Wallah aims
to make coding accessible to students, especially those preparing for competitive exams like JEE and
those looking to improve their problem-solving skills. The platform’s coding courses are designed
to provide hands-on experience, helping students gain practical skills in software development and
coding challenges.

vi
List of Figures

Fig no. Figure Name Page No.


Fig.3.1 Code structure 12

Fig.4.1 Main Output 15

Fig.4.2 Dataset description 15

Fig.4.3 Data Visualization 16

Fig.4.4 Heatmap 16

Fig.4.5 Size of train and test dataset 17

Fig.4.6 Box plots 17

Fig.4.7 Linear Regression 18

Fig.4.8 Lasso Regression 18

Fig.4.9 Ridge Regression 18

Fig.4.10 Elastic Net Regression 18

vii
Table of Content
Title Page no.
Declaration ii
Certificate iii
Acknowledgment iv
Abstract v
Company profile vi
List of figures vii
Chapter 1: Introduction 1-2
1.1 Problem Statement 1
1.2 Project Objective 1
1.3 Project Scope 2
1.4 Goals 2
Chapter 2: Literature Survey 3-10
2.1 Python 3
2.2 Machine Learning 5
2.3 Frontend 6
2.4 Backend 6
2.5 Frameworks 7
2.6 Flask 8
Chapter 3: Project in Detail 11-14
3.1 Introduction 11
3.2 What is FWI? 11
3.3 Purpose 12
3.4 Code Structure 12
3.5 Why is it popular? 12
Chapter 4: Results and Outputs 15-20
4.1 Main Output 15
4.2 Dataset 15
4.3 FE and EDA 16
4.4 Correlation 16
4.5 Training and Testing Dataset 17
4.6 Box Plots 17
4.7 Modelling 18
Chapter 5: Conclusion & Future Scope 21
5.1 Conclusion 21
5.2 Future Scope 21
References 22
CHAPTER-1

INTRODUCTION
1.1 Problem Statement

Forest fires are a significant environmental and economic issue in Algeria, impacting biodiversity,
climate, and human health. Predicting the Fire Weather Index (FWI) in this region is crucial for
understanding fire behaviour and making timely management decisions. The Algerian Forest dataset
contains meteorological information and associated FWI values, representing real-world
environmental conditions in Algeria’s forests.

1.2 Project Objectives

The objective of this project is to develop a predictive model for the Fire Weather Index (FWI)
specifically tailored to Algerian forest conditions. The FWI is a critical metric used to gauge fire risk
based on weather factors like temperature, humidity, wind speed, and rainfall. By accurately forecasting
FWI, the project aims to equip forest management agencies in Algeria with an essential tool for assessing
fire risk levels and making proactive decisions to prevent and manage forest fires.
Through this project, we will analyse historical weather data from Algerian forests and identify
patterns linked to fire risks. The goal is to train a model that reliably predicts FWI values, helping
officials anticipate periods of high fire risk and implement preventive measures in advance. Accurate
FWI predictions are vital for optimizing resource allocation, minimizing environmental damage, and
protecting human lives and property.
Overall, this project seeks to enhance Algeria's fire management capabilities by providing a data-
driven solution that improves preparedness and response strategies. The long-term impact is to
contribute toward a safer, more resilient environment through better forest fire prediction and risk
management practices.

This achieves following -


• High-Accuracy FWI Prediction Model
• Early Warning and Alert System
• Data-Driven Insights into Fire Risk Factors
• Custom Solution for Algerian Forest Ecosystem
• Enhanced Forest Management and Conservation Efforts

1.3 Project Scope


● The scope of this project involves designing and implementing a predictive model to
estimate the Fire Weather Index (FWI) for Algerian forests. Using historical meteorological
data, the model will assess key environmental factors—such as temperature, humidity, wind
speed, and rainfall—to accurately forecast FWI values and thereby predict fire risk levels.
This model will be customized to Algeria’s unique climate and forest conditions, making it
1
especially relevant for local fire management.
● Key stages include data preprocessing, feature engineering, model selection, and
optimization. Once validated, the model can be integrated into a real-time fire risk alert
system for early warnings. Additionally, the project will explore the relationships between
various weather factors and fire risk, providing valuable insights for forestry management.
● Ultimately, this project will support Algerian forestry agencies in implementing proactive
fire prevention strategies, optimizing resource allocation, and protecting the region’s forests
and biodiversity.

1.4 Goals
• To create a reliable machine learning model that accurately predicts FWI values based on
meteorological data from Algerian forests, minimizing prediction error.
• To establish a system that alerts forestry agencies of high fire risk in real-time, based on the
predicted FWI values.

2
CHAPTER-2
LITERATURE SURVEY

In a literature survey, identifying previous researchers or projects that have contributed to similar work
on Fire Weather Index (FWI) prediction is valuable. Researchers from environmental sciences, forestry,
and data science have worked on wildfire prediction, each contributing different methods and insights.

1. Canadian Forest Service: They developed the original Canadian Fire Weather Index (FWI)
system, which many countries use for wildfire risk prediction. Their work serves as the
foundation for wildfire indices globally.
2. U.S. Forest Service & NASA Collaborations: These organizations have conducted significant
research integrating satellite imagery and meteorological data for wildfire prediction. NASA's
work with machine learning models for environmental applications has been particularly
impactful.
3. Academic Researchers: Numerous academic researchers have explored machine learning
applications for FWI, such as using neural networks, random forests, or support vector machines
to improve prediction accuracy. Researchers in this field often publish in journals like Remote
Sensing of Environment and International Journal of Wildland Fire.
4. Recent Data Science Projects: Platforms like Kaggle have also hosted competitions and datasets
for wildfire prediction, contributing community-driven insights, especially with modern
machine learning frameworks like XGBoost, LSTM, and other deep learning models.

2.1 Python: -

Python is an interpreted high-level programming language for general-purpose programming.


Created by Guido van Rossum and first released in 1991, Python has a design philosophy that
emphasizes code readability, notably using significant whitespace. It provides constructs that enable
clear programming on both small and large scales. In July 2018, Van Rossum stepped down as the
leader in the language community after 30 years.

Python features a dynamic type system and automatic memory management. It supports multi
paradigms, object-oriented, imperative, functional and procedural, easy to learn and has a large and
comprehensive standard library.

Python interpreters are available for many operating systems. Python, the reference implementation
of Python, is open-source software and has a community-based development model, as do nearly
all of Python's other implementations. Python and CPython are managed by the non-profit Python
Software Foundation.

Python has a simple, easy to learn syntax emphasizes readability hence, it reduces the cost of
program maintenance. Also, Python supports modules and packages, which encourages program
3
modularity and code reuse.[2]http://www.python.org/doc.

2.1.1 Advantages of using PYTHON

Python offers simplicity and readability, making it accessible for beginners and efficient for
experienced developers. It has extensive libraries (e.g., Pandas, NumPy, Scikit-Learn) for data
analysis and machine learning, robust community support, and compatibility across platforms,
making it ideal for rapid development and deployment of data-driven projects.

1. Presence of Third-Party Modules:


The Python Package Index (PyPI) contains numerous third-party modules that make Python
capable of interacting with most of the other languages and platforms.

2. Extensive Support Libraries:


Python provides a large standard library which includes areas like internet protocols, string
operations, web services tools and operating system interfaces. Many high use programming
tasks have already been scripted into the standard library which reduces the length of code to
be written significantly.

3. Open Source and Community Development:


Python language is developed under an OSI-approved open-source license, which makes it free
to use and distribute, including for commercial purposes.
Further, its development is driven by the community which collaborates for its code through
hosting conferences and mailing lists, and provides for its numerous modules.

4. Learning Ease and Support Available:


Python offers excellent readability and uncluttered simple-to-learn syntax which helps
beginners to utilize this programming language. The code style guidelines, PEP 8, provide a set
of rules to facilitate the formatting of code. Additionally, the wide base of users and active
developers has resulted in a rich internet resource bank to encourage development and the
continued adoption of the language.

5. User-friendly Data Structures:


Python has built-in list and dictionary data structures which can be used to construct fast
runtime data structures. Further, Python also provides the option of dynamic high-level data
typing which reduces the length of support code that is needed.

6. Productivity and Speed:


Python has clean object-oriented design, provides enhanced process control capabilities, and
possesses strong integration and text processing capabilities and its own unit testing framework, all
of which contribute to the increase in its speed and productivity. Python is considered a viable
option for building complex multi-protocol network applications
4
2.2 Machine Learning

Machine learning (ML) is a field within artificial intelligence (AI) focused on developing algorithms
that enable computers to learn from data and improve at tasks over time without explicit
programming. It allows systems to identify patterns, make decisions, and predict outcomes by
analysing and learning from historical data. Machine learning models generally operate through
three main types of learning:
1. Supervised Learning: Involves training a model on labelled data, where inputs are paired with the
correct output. Common tasks include classification (e.g., spam detection) and regression (e.g.,
predicting housing prices).
2. Unsupervised Learning: The model works with unlabelled data, finding structure and patterns
within it. It’s widely used for clustering (e.g., customer segmentation) and dimensionality reduction
(e.g., simplifying data features).
3. Reinforcement Learning: This method involves training a model through rewards and penalties
based on its actions, helping it learn strategies for tasks like game playing or robotic navigation.
Machine learning models leverage algorithms such as linear regression, decision trees, neural
networks, and clustering methods like K-means. The development process includes data collection,
preprocessing, feature engineering, model training, and evaluation to ensure the model can
generalize well to new data.
ML has transformative applications in industries like healthcare (for diagnosis), finance (fraud
detection), retail (recommendation engines), and manufacturing (predictive maintenance). With
advancements in computing power and data availability, machine learning is increasingly pivotal to
automating decision-making, enabling personalized experiences, and solving complex problems at
scale. As a result, it plays a critical role in advancing AI capabilities and innovation.
[5] https://pwskills.com/

2.2.1 Models

Machine learning models are algorithms designed to find patterns in data and make predictions or
decisions based on it. Some common types include:

1. Linear Regression: Predicts continuous values by establishing a linear relationship between input
variables and the target variable.
2. Decision Trees: Splits data into branches based on feature values for classification or regression
tasks.
3. Support Vector Machines (SVM): Finds the optimal boundary that separates data into classes.
4. Neural Networks: Mimics the human brain structure, excelling at complex tasks like image and
speech recognition.
5. Clustering Models (e.g., K-means): Groups data based on similarity in unsupervised learning
scenarios

5
2.2.2 Importance of Machine Learning

Machine learning is vital for transforming data into actionable insights and automating complex
tasks across industries. It enables systems to analyse vast amounts of data, identify patterns, and
make predictions with minimal human intervention, leading to more informed decision-making. ML
drives innovation in fields like healthcare (for disease diagnosis and drug discovery), finance (fraud
detection and algorithmic trading), retail (personalized recommendations), and transportation (self-
driving technology). By continuously learning from data, machine learning enhances productivity,
efficiency, and personalization, making it fundamental to advancements in artificial intelligence and
essential for addressing today’s data-driven challenges.

2.3 Frontend

In machine learning, the frontend is crucial for creating user interfaces that allow users to interact
with ML models effectively. A well-designed frontend helps users input data, view predictions,
interpret results, and manage settings, making machine learning applications accessible even to those
without technical expertise.

Key Components of Frontend in ML


1. Data Input and Processing: Users need input forms or upload options to provide data to the model.
Interactive tools, such as sliders, drop-downs, or text fields, make it easy to customize inputs.
2. Visualization: Visual tools like graphs, charts, and heatmaps help users understand model
predictions, performance, and underlying data trends, supporting informed decision-making.
3. Interpretability and Explanations: For complex models, the frontend can include features like feature
importance scores, explanations, and confidence levels, which allow users to trust and interpret
model outputs.
4. Real-Time Interaction: For real-time ML applications (e.g., recommendation engines, predictive
analytics), the frontend ensures smooth interactions, delivering fast predictions and updates for a
seamless experience.
5. Deployment and Monitoring: An ML frontend can also support model management by allowing
users to monitor model performance over time, track metrics, and manage version updates.

Common Technologies
Frontend technologies like React, Vue, and Angular are often used alongside Python Flask or Django
APIs to connect the frontend with the backend ML models, ensuring smooth data flow and real-time
responses.

2.4 Backend

In a machine learning project, the backend is responsible for handling the processing, storage, and
deployment of ML models, as well as managing data and user requests. It serves as the core that connects
6
the frontend with the machine learning model, enabling seamless communication between the user
interface and the model’s computations.

Key Components of the Backend in ML Projects


1. Data Management and Preprocessing: The backend handles data storage, retrieval, and
preprocessing, which may include data cleaning, scaling, and feature engineering. Databases like
MySQL, MongoDB, or data lakes may be used to store both raw and pre-processed data.
2. Model Hosting and Serving: Once the model is trained, it is hosted on the backend using frameworks
like Flask, Django, or Fast API in Python. This allows the model to be served as an API endpoint,
where it can receive data, make predictions, and send the results to the frontend.
3. Scalability and Performance: The backend must support scalability to handle multiple requests
simultaneously and ensure low-latency responses. This may involve containerization with Docker
and orchestration with Kubernetes to deploy on cloud platforms like AWS, Google Cloud, or Azure.
4. Security and Authentication: For secure access, backend infrastructure manages user authentication,
data encryption, and authorization, ensuring that sensitive data and model endpoints are protected.
5. Logging and Monitoring: To track model performance and backend health, logging, and monitoring
tools (e.g., Prometheus, Grafana) are often implemented. These tools help observe model drift,
performance degradation, and server load.

Common Technologies
Backend development in ML commonly uses Python frameworks (Flask, Django), Node.js for REST
APIs, and database systems like SQL or NoSQL databases. Additionally, cloud services and CI/CD
pipelines are integrated to automate model deployment and updates.

2.5 Frameworks

In machine learning, various frameworks provide the tools and libraries needed for data processing,
model building, deployment, and scalability. Here are some widely used frameworks across different
stages of an ML project:

1. Machine Learning and Deep Learning Frameworks


● TensorFlow: Developed by Google, TensorFlow is a popular framework for deep learning,
offering extensive support for neural networks and large-scale machine learning tasks.
● PyTorch: Developed by Facebook, PyTorch is known for its flexibility and ease of use,
especially popular in research and academic settings for deep learning projects.
● Scikit-Learn: A comprehensive library for traditional machine learning in Python, it provides
tools for classification, regression, clustering, and more.
● Keras: A high-level neural networks API built on TensorFlow, making it easier to prototype
deep learning models quickly.
● XGBoost, LightGBM, and CatBoost: Specialized frameworks for gradient boosting, known for
their performance and efficiency, often used in competitions and structured data problems.

7
2. Data Preprocessing and Analysis Frameworks
● Pandas: A data manipulation library in Python, ideal for data cleaning, transformation, and
handling structured data.
● NumPy: A foundational library for numerical computing in Python, providing support for arrays
and mathematical functions.
● Apache Spark: An open-source framework for big data processing, used for handling large
datasets with distributed computing.

3. Model Deployment and Serving Frameworks


● Flask and Django: Web frameworks in Python often used to wrap ML models into APIs, making
it easy to deploy models as web services.
● FastAPI: A modern, fast web framework in Python, popular for building APIs with automatic
interactive documentation.
● TensorFlow Serving: A system specifically designed for deploying TensorFlow models in
production environments.
● Docker: A containerization platform that packages ML models and dependencies, enabling
consistent deployment across environments.

4. Big Data and Distributed Machine Learning Frameworks


● Apache Hadoop: A framework for distributed storage and processing of large data sets across
clusters.
● Dask: A parallel computing library that integrates with the Python ecosystem, allowing for
scalable data analysis.
● Ray: A framework for distributed applications, making it possible to scale ML workloads easily.

5. Visualization Frameworks
● Matplotlib, Seaborn: Python libraries for creating static, animated, and interactive
visualizations.
● Plotly: An interactive visualization library useful for building dashboards.
● TensorBoard: A TensorFlow tool for visualizing metrics, model structure, and data flow graphs
in deep learning models.

These frameworks streamline the machine learning lifecycle, from data preprocessing and model
development to deployment and monitoring, making ML projects more efficient, scalable, and accessible

2.6 Flask

Flask is a lightweight, open-source web framework for Python, designed for building web applications
and APIs. Known for its simplicity and flexibility, Flask provides only the essentials, enabling
developers to create web services quickly without unnecessary overhead. This "microframework"
8
approach means it lacks built-in tools like form validation or database abstraction, allowing developers
to integrate only the extensions they need, making it versatile for small to large applications.
Flask is widely used in machine learning projects to serve models as RESTful APIs, enabling models to
accept data input, make predictions, and return results to the client application. It’s compatible with
numerous libraries and works well with HTML templates (via Jinja2) and JSON data, which is essential
for modern web applications.
Flask’s ease of setup, extensive community support, and scalability make it popular for prototyping and
deploying applications, especially for data science, machine learning, and full-stack web development
projects.[3] http://en.wikipedia.org/wiki/Flask.

2.6.1 Installation and Virtual Environment


When working with Python projects, including Flask and machine learning, setting up a virtual
environment and installing dependencies properly is essential to manage packages and avoid conflicts.
Here’s a quick guide:

1. Install Python
Ensure Python is installed on your system. You can check by running:
python --version

If Python isn’t installed, download it from Python’s official website.

2. Set Up a Virtual Environment


In your project directory, create a virtual environment by running:
python -m venv myenv

Replace myenv with your preferred name for the environment.

3. Activate the Virtual Environment

Activate the environment to isolate dependencies:

On Windows:
myenv\Scripts\activate

On macOS/Linux:
source myenv/bin/activate

4. Install Flask or Other Packages


Once the virtual environment is activated, install Flask or other required packages:
pip install flask

5. Deactivate the Virtual Environment


9
When you’re done, deactivate it by running:
deactivate

Using a virtual environment ensures each project has isolated dependencies, preventing conflicts across
projects.

10
CHAPTER 3
PROJECT IN DETAIL
3.1 Introduction
The Fire Weather Index (FWI) is a critical metric used to assess wildfire risk based on weather and
environmental factors. Developed as part of the Canadian Forest Fire Weather Index System, FWI
combines various weather elements—such as temperature, humidity, wind speed, and rainfall—to
produce a single value representing the fire risk level. High FWI values indicate dry and windy conditions
favourable to fire ignition and spread, while lower values represent less risky weather conditions. For
regions like Algeria, where wildfires pose severe threats to forests, biodiversity, and local communities,
accurately predicting the FWI can significantly enhance wildfire prevention and management efforts.

This project focuses on developing a machine learning model tailored to predict FWI in Algerian forests.
By leveraging historical weather data and exploring patterns in meteorological conditions, the model
aims to deliver reliable FWI predictions specific to Algeria's climate. This project involves data
collection, preprocessing, feature engineering, and model training, enabling accurate predictions that can
be used in real-time.

The implementation of this FWI prediction model can transform forest management practices by
enabling authorities to monitor fire risk levels proactively. With timely warnings, forest management
agencies can take preventive actions, allocate resources effectively, and respond swiftly to potential
wildfire outbreaks. Ultimately, this project supports efforts to protect natural landscapes, wildlife, and
communities, contributing to sustainable and resilient forest ecosystems in Algeria. The project also
provides a foundation for applying similar models in other fire-prone regions, highlighting the role of
machine learning in environmental management

3.2 What is FWI?


The Fire Weather Index (FWI) is a crucial metric used to assess the potential risk of wildfire in a given
area based on weather conditions. Developed as part of the Canadian Forest Fire Weather Index System,
FWI combines several weather factors, including temperature, humidity, wind speed, and rainfall, into a
single number that represents fire risk. High FWI values indicate conditions conducive to fire ignition
and rapid spread, such as hot, dry, and windy weather, while low values suggest safer, wetter conditions.

FWI is widely used by forest fire management agencies to predict and monitor fire hazards, guiding
decisions on resource allocation, fire prevention, and control efforts. It helps authorities identify
periods of elevated fire risk, allowing for early intervention and strategic planning. Accurate FWI
forecasting plays a vital role in reducing wildfire damage to ecosystems, property, and human lives
by enabling timely and proactive responses.

11
3.3 Purpose:
The purpose of Fire Weather Index (FWI) prediction is to assess and predict the risk of wildfires based
on weather and environmental conditions. By accurately forecasting FWI values, authorities can
anticipate periods of high fire risk and take proactive measures to reduce the impact of wildfires. The
key purposes of FWI prediction include:

1. Early Warning: Provide early alerts on high fire-risk conditions, allowing authorities and fire
management teams to prepare, deploy resources, and implement preventive measures.
2. Resource Allocation: Help allocate firefighting resources efficiently, ensuring that areas at higher
risk receive the attention and support they need.
3. Fire Prevention: Support fire prevention strategies by identifying dangerous weather patterns that
increase the likelihood of fire ignition and spread.
4. Forest and Ecosystem Protection: Protect forests, biodiversity, and local communities by predicting
and mitigating wildfire risks, reducing the destruction caused by uncontrolled fires.
5. Improved Decision-Making: Aid decision-makers in government, forestry, and emergency services
in planning and managing wildfire response strategies based on accurate predictions.

In essence, FWI prediction helps mitigate the destructive effects of wildfires by offering timely and
reliable data for decision-making and resource management.

3.4 Code Structure

Fig.3.1 Code structure


3.5 Why is it popular?
The Fire Weather Index (FWI) prediction system has gained popularity for several reasons, especially in
the context of wildfire prediction and management. Here’s why it is highly regarded:

1. Early Warning for Wildfires


FWI is a critical tool for predicting fire risk. By using weather data to estimate how easily a fire can start
and spread, it helps fire management teams take proactive steps to reduce the risk of wildfires. This early

12
warning system helps in:

● Timely evacuation alerts


● Targeted firefighting strategies
● Optimizing resource allocation (e.g., water, firefighting teams)

2. Data-Driven Decision Making


FWI predictions are based on meteorological data such as temperature, humidity, wind speed, and
rainfall. This data-driven approach enables more accurate predictions and helps decision-makers to
respond based on hard facts rather than intuition. This can reduce uncertainty and increase effectiveness
in wildfire management.

3. Climate Change Awareness


With climate change increasing the frequency and intensity of wildfires, FWI predictions have become
even more crucial. Researchers and environmentalists use FWI data to analyse how changing weather
patterns impact wildfire risks. This allows for:

● Adaptation strategies to future climate conditions.


● Better understanding of fire behaviour under different weather scenarios.

4. Preventive Measures
FWI helps governments, fire departments, and forestry agencies implement preventive measures such as
controlled burns, fire bans, and forest management activities when FWI levels are high. This reduces the
overall frequency and severity of wildfires.

5. Global Applicability
FWI systems are widely used across the world, not just in specific regions. It is adaptable to different
climates and geographic areas, making it an internationally recognized tool for wildfire risk prediction.
This has helped create global cooperation in wildfire monitoring and prevention.

6. Integration with Modern Technology


With advancements in machine learning and artificial intelligence, FWI prediction models can now be
integrated with real-time satellite data, sensors, and weather forecasting systems. This combination of
technologies improves the timeliness and accuracy of fire predictions, making the system more effective
in fire risk forecasting.

7. Resource Optimization
FWI prediction systems help optimize resource management, from allocating fire crews to scheduling
preventative maintenance and monitoring equipment. This not only saves resources but also helps reduce
the economic impact of wildfires.

13
8. Public Safety
In addition to helping firefighting authorities, FWI also contributes to public safety by providing real-
time risk alerts to the general public through various platforms, such as mobile apps and websites,
ensuring that citizens are informed and can take the necessary precautions.

14
CHAPTER-4
RESULTS AND OUTPUTS
4.1 Main Output

Fig.4.1 Main output

4.2 Dataset

Fig.4.2 Dataset description

15
4.3 FE and EDA (Feature Engineering and Exploratory Data Analysis)
FE (Feature Engineering) and EDA (Exploratory Data Analysis) are crucial steps in data science and
machine learning.
- Feature Engineering (FE) involves creating new features or modifying existing ones to improve model
performance. It includes techniques like encoding categorical variables, scaling data, or combining
features to capture essential patterns.
- Exploratory Data Analysis (EDA) is the process of analysing and visualizing data to understand its
structure, patterns, and relationships before modelling. EDA involves summary statistics, data
visualization (e.g., histograms, scatter plots), and identifying data issues like missing values or outliers.
Both FE and EDA are essential for building accurate, reliable models.

Fig.4.3 Data visualization


4.4 Correlation
Correlation is a statistical measure that describes the strength and direction of a relationship between
two variables. It ranges from -1 to +1:
 +1 indicates a perfect positive correlation (as one variable increases, the other also increases).
 -1 indicates a perfect negative correlation (as one variable increases, the other decreases).
 0 indicates no correlation (the variables do not affect each other).
Correlation is useful in data analysis for understanding relationships between features, which can guide
feature selection and help avoid multicollinearity in predictive modelling.

16
Fig.4.4 Heatmap
4.5 Training and Testing Dataset
Training Data: This portion of the dataset is used to train the model, allowing it to learn patterns,
relationships, and associations within the data. The model adjusts its parameters based on the training
data to make predictions.
Test Data: After training, the test data is used to evaluate the model's performance. The test data is
separate from the training data, ensuring the model's accuracy and generalization ability on unseen data.

Fig.4.5 size of train and test dataset


4.6 Box Plots
A box plot (or box-and-whisker plot) is a graphical representation of the distribution of a dataset,
providing a summary of its minimum, first quartile (Q1), median (Q2), third quartile (Q3), and maximum
values. It’s useful for visualizing the spread and skewness of the data, as well as identifying potential
outliers

17
Fig.4.6 Box plots
4.7 Modelling
Modelling in data science is creating algorithms that learn patterns from data to make predictions,
classify, or analyse outcomes.
4.7.1 Linear Regression
Linear regression is a statistical method for modelling the relationship between a dependent variable
and one or more independent variables. By fitting a linear equation to observed data, it estimates how
changes in the predictors influence the target. It's widely used for its simplicity and interpretability,
especially in straightforward datasets.

Fig.4.7 Linear Regression


4.7.2 Lasso Regression
Lasso regression is a type of linear regression that includes a penalty term to shrink coefficients toward
zero, reducing model complexity. This penalty (L1 regularization) encourages sparsity by setting some
coefficients exactly to zero, which helps with feature selection and can improve prediction accuracy,
especially with high-dimensional data.

18
Fig.4.8 Lasso Regression
4.7.3 Ridge Regression
Ridge regression is a linear regression technique that adds an L2 penalty to the loss function, shrinking
coefficients to reduce model complexity and multicollinearity issues. This penalty term discourages
large coefficient values, leading to a more stable and less overfit model, especially useful when
predictors are highly correlated.

Fig.4.9 Ridge Regression


4.7.4 Elastic Net Regression
Elastic Net regression combines Lasso (L1) and Ridge (L2) penalties to handle linear regression in
cases with multicollinearity or high-dimensional data. By balancing the two penalties, it selects relevant
features (like Lasso) while reducing overfitting (like Ridge), making it effective for datasets with many
correlated predictors.

19
Fig.4.10 ElasticNet Regression

20
CHAPTER-5
CONCLUSION & FUTURE SCOPE

5.1 Conclusion
The Fire Weather Index (FWI) prediction project has demonstrated the effectiveness of using weather
data to predict the risk of wildfires. By analysing key meteorological factors such as temperature,
humidity, wind speed, and rainfall, this project has successfully modelled and predicted fire risk with
significant accuracy, which is vital for wildfire management and prevention strategies.

The project utilized machine learning models, including Random Forest, to predict the FWI based on
historical weather data from the Algerian Forest dataset. By training and evaluating the model, we have
been able to showcase the practical application of these models in real-world scenarios. The use of data
preprocessing techniques, such as handling missing values and feature engineering, was essential in
optimizing the input data for better model performance.

One of the key findings of this project is that the FWI prediction model plays a critical role in early
detection and prevention of wildfires. Accurate predictions of fire risks allow forestry agencies, fire
departments, and local governments to take timely actions, such as deploying firefighting resources,
issuing warnings to the public, and implementing preventive measures. This can significantly reduce the
devastation caused by wildfires, both in terms of environmental damage and human lives.

Furthermore, the project integrated a Flask API to serve the trained model, allowing real-time predictions
via a web interface. This deployment strategy ensures that the model can be easily accessed and utilized
in various operational settings, whether for daily monitoring or emergency responses.

In conclusion, this project highlights the importance of predictive modelling in wildfire risk management.
By leveraging weather data and machine learning, we have demonstrated how technology can improve
decision-making, optimize resource allocation, and enhance public safety. As wildfires become
increasingly frequent due to climate change, predictive systems like FWI models will continue to play
an indispensable role in mitigating the impact of these natural disasters. The successful implementation
of this project also opens doors to further research, exploring the integration of more advanced models
and data sources to improve the accuracy and efficiency of wildfire prediction systems.

5.2 Future Scope

The future scope of the FWI Prediction project includes enhancing model accuracy by integrating
advanced machine learning techniques and real-time data sources such as satellite images and IoT
sensors. Further, expanding the model to predict across diverse geographic regions can make it
universally applicable, aiding global fire management efforts. Leveraging AI for anomaly detection and
incorporating climate change projections could also improve long-term predictions. Adding user-friendly
dashboards and mobile apps could increase accessibility, allowing fire management teams and the public
to receive instant alerts and insights, making wildfire prevention and mitigation more effective .
21
REFERENCES
[1] Flask homepage. http://www.flaskproject.com/.
[2] Python documentation. http://www.python.org/doc.
[3] Flask (web framework). http://en.wikipedia.org/wiki/Flask.
[4] Flask documentation. https://en.wikipedia.org/wiki/Flask_(web_framework)
[5] https://pwskills.com/

22

You might also like