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
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: odbl
|
| 3 |
+
---
|
| 4 |
+
# Predicting Whether a Nuclear Reactor Is PWR or BWR
|
| 5 |
+
|
| 6 |
+
## Dataset Overview
|
| 7 |
+
|
| 8 |
+
This project is based on the **Geo Nuclear Data** dataset from Kaggle.
|
| 9 |
+
The dataset contains information about nuclear reactors around the world, including geographic and technical features such as:
|
| 10 |
+
|
| 11 |
+
- Country
|
| 12 |
+
- Plant name
|
| 13 |
+
- Latitude
|
| 14 |
+
- Longitude
|
| 15 |
+
- Reactor type
|
| 16 |
+
- Capacity
|
| 17 |
+
- Status
|
| 18 |
+
- Construction and operational dates
|
| 19 |
+
|
| 20 |
+
The original dataset was cleaned and filtered in order to focus only on two reactor types:
|
| 21 |
+
|
| 22 |
+
- **PWR**
|
| 23 |
+
- **BWR**
|
| 24 |
+
|
| 25 |
+
## Research Question
|
| 26 |
+
|
| 27 |
+
**Can we predict whether a reactor is PWR or BWR?**
|
| 28 |
+
|
| 29 |
+
## Data Wrangling and Cleaning
|
| 30 |
+
|
| 31 |
+
After cleaning, the final dataset contained **573 rows**.
|
| 32 |
+
|
| 33 |
+
## Descriptive Statistics and Main Notes
|
| 34 |
+
|
| 35 |
+
The cleaned dataset still showed class imbalance:
|
| 36 |
+
|
| 37 |
+
- **PWR:** 483 reactors
|
| 38 |
+
- **BWR:** 120 reactors
|
| 39 |
+
|
| 40 |
+
This means the dataset contains many more PWR reactors than BWR reactors, which may affect classification performance.
|
| 41 |
+
|
| 42 |
+
## Research Questions, Visualizations, and Answers
|
| 43 |
+
|
| 44 |
+
### Question 1: Is there a difference in capacity between PWR and BWR reactors?
|
| 45 |
+
|
| 46 |
+
This question was explored using a bar chart comparing the **mean** and **median** capacity of each reactor type.
|
| 47 |
+
|
| 48 |
+
**Answer:**
|
| 49 |
+
Yes. PWR reactors generally show higher capacity values than BWR reactors.
|
| 50 |
+
Both the average and the median capacity are higher for PWR reactors, although the number of PWR reactors in the dataset is also much larger.
|
| 51 |
+
|
| 52 |
+
### Question 2: Are PWR and BWR reactors distributed differently across geographic locations?
|
| 53 |
+
|
| 54 |
+
This question was explored using a **world map** based on latitude and longitude.
|
| 55 |
+
|
| 56 |
+
**Answer:**
|
| 57 |
+
The map shows that nuclear reactors are highly concentrated near coastlines.
|
| 58 |
+
There is some geographic difference between PWR and BWR reactors, but not a perfect separation.
|
| 59 |
+
For example, many reactors in Russia and nearby regions appear to be PWR, and China also shows many PWR reactors.
|
| 60 |
+
# in general i see that there is two teams here, team "washington" and team "russia/china" it's not super obvies but we can defenetly can see it from the map.
|
| 61 |
+
# maybe i shuld improve my model by consider in which "team" the reactor is located.
|
| 62 |
+
|
| 63 |
+
### Question 3: Which countries contain the highest numbers of PWR and BWR reactors?
|
| 64 |
+
|
| 65 |
+
This question was explored using a **stacked bar chart** of reactor counts by country and reactor type.
|
| 66 |
+
|
| 67 |
+
**Answer:**
|
| 68 |
+
The United States and China appear to have the highest numbers of reactors, followed by countries such as Japan and France. russia is surprisingly low maybe because of chernobyl
|
| 69 |
+
The distribution of PWR and BWR reactors is not the same in all countries, which suggests that country may be useful as a predictive feature.
|
| 70 |
+
|
| 71 |
+
### Question 4: How does the total global capacity compare between PWR and BWR reactors?
|
| 72 |
+
|
| 73 |
+
This question was explored using a **bar chart** of total capacity by reactor type.
|
| 74 |
+
|
| 75 |
+
**Answer:**
|
| 76 |
+
PWR reactors contribute much more total global capacity than BWR reactors in this dataset.
|
| 77 |
+
This matches the earlier findings that PWR reactors are both more common and usually larger in capacity.
|
| 78 |
+
|
| 79 |
+
## Main Insights
|
| 80 |
+
|
| 81 |
+
The main findings of the exploratory analysis were:
|
| 82 |
+
|
| 83 |
+
- **Capacity** was the most informative feature in the dataset.
|
| 84 |
+
- Geographic location was useful, but not strong enough on its own.
|
| 85 |
+
- There was no single feature that perfectly separated PWR and BWR reactors.
|
| 86 |
+
- The classification task seems to depend on a **combination of several features together**, not on one perfect variable.
|
| 87 |
+
|
| 88 |
+
## Decisions Made During the Analysis
|
| 89 |
+
|
| 90 |
+
Several important decisions were made during the project:
|
| 91 |
+
|
| 92 |
+
- I decided to focus only on **PWR** and **BWR** reactors.
|
| 93 |
+
- I removed rows with missing values in important columns.
|
| 94 |
+
- I removed rows with missing coordinates because location was relevant to the research question.
|
| 95 |
+
- I filled missing values in `Capacity` using the median.
|
| 96 |
+
- I checked skewness in `Capacity`, but did not apply transformation because the skewness was moderate and not extreme.
|
| 97 |
+
- I compared several models before selecting the final one.
|
| 98 |
+
|
| 99 |
+
## Modeling
|
| 100 |
+
|
| 101 |
+
The target variable was:
|
| 102 |
+
|
| 103 |
+
- **ReactorType**
|
| 104 |
+
- `0 = BWR`
|
| 105 |
+
- `1 = PWR`
|
| 106 |
+
|
| 107 |
+
The main engineered and selected features included:
|
| 108 |
+
|
| 109 |
+
### Numeric features
|
| 110 |
+
- Capacity
|
| 111 |
+
- Latitude
|
| 112 |
+
- Longitude
|
| 113 |
+
- AbsLatitude
|
| 114 |
+
- ConstructionYear
|
| 115 |
+
- OperationalYear
|
| 116 |
+
- YearsToOperation
|
| 117 |
+
- ReactorAge
|
| 118 |
+
|
| 119 |
+
### Categorical features
|
| 120 |
+
- Status
|
| 121 |
+
- Country
|
| 122 |
+
- CountryCode
|
| 123 |
+
|
| 124 |
+
The following models were tested:
|
| 125 |
+
|
| 126 |
+
- Logistic Regression
|
| 127 |
+
- Balanced Logistic Regression
|
| 128 |
+
- Random Forest
|
| 129 |
+
- Gradient Boosting
|
| 130 |
+
|
| 131 |
+
## Model Results
|
| 132 |
+
|
| 133 |
+
The best model was **Random Forest**.
|
| 134 |
+
|
| 135 |
+
### Best Model: Random Forest
|
| 136 |
+
|
| 137 |
+
- **Accuracy:** 0.8957
|
| 138 |
+
- **Macro F1-score:** 0.8467
|
| 139 |
+
- **BWR Recall:** 0.7917
|
| 140 |
+
- **PWR Recall:** 0.9231
|
| 141 |
+
|
| 142 |
+
**Interpretation:**
|
| 143 |
+
Random Forest performed better than the other models because it was able to capture more complex patterns in the data.
|
| 144 |
+
It also gave the best balance between overall performance and detection of both reactor types.
|
| 145 |
+
|
| 146 |
+
## Limitations
|
| 147 |
+
|
| 148 |
+
This project has several limitations:
|
| 149 |
+
|
| 150 |
+
- Some useful variables originally had missing values.
|
| 151 |
+
- The dataset is imbalanced, with many more PWR reactors than BWR reactors.
|
| 152 |
+
- Geographic coordinates alone do not clearly separate the two reactor types.
|
| 153 |
+
- Some interesting geographic or political patterns may exist, but they would require further research beyond this dataset.
|
| 154 |
+
|
| 155 |
+
## Final Conclusion
|
| 156 |
+
|
| 157 |
+
This project showed that it is possible to predict whether a nuclear reactor is PWR or BWR with good performance.
|
| 158 |
+
|
| 159 |
+
The exploratory analysis showed that **Capacity** is the strongest single feature, while geographic location and country also provide useful information.
|
| 160 |
+
However, no single feature perfectly separates the two classes.
|
| 161 |
+
|
| 162 |
+
Among all tested models, **Random Forest** gave the best results and was selected as the final model.
|