File size: 6,509 Bytes
2580020
 
326dc36
 
 
 
cf21579
 
 
 
 
 
 
 
 
326dc36
2580020
c2ae208
2580020
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a51dd73
 
 
 
 
 
 
 
 
 
 
 
2580020
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b606877
c2ae208
2580020
 
 
 
 
 
 
 
6e6519a
c2ae208
2580020
 
 
c2ae208
 
 
 
2580020
 
 
 
 
6e6519a
c2ae208
2580020
c2ae208
87ce00a
2580020
 
 
 
 
 
6e6519a
c2ae208
2580020
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3dd1bd4
 
 
2580020
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cf21579
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
---
license: odbl
configs:
- config_name: default
  data_files:
  - split: train
    path: nuclear_power_plants_dataset_cleaned_and_sorted.csv
language:
- en
tags:
- chemistry
- nuclear
- geo
size_categories:
- 1K<n<10K
---
---

# Predicting Whether a Nuclear Reactor Is PWR or BWR

## Dataset Overview

This project is based on the **Geo Nuclear Data** dataset from Kaggle.  
The dataset contains information about nuclear reactors around the world, including geographic and technical features such as:

- Country
- Plant name
- Latitude
- Longitude
- Reactor type
- Capacity
- Status
- Construction and operational dates

The original dataset was cleaned and filtered in order to focus only on two reactor types:

- **PWR**
- **BWR**

## Sample Usage

You can load this dataset directly from Hugging Face using the `datasets` library:

```python
from datasets import load_dataset

dataset = load_dataset("jonblustein/GeoNuclearData")
df = dataset["train"].to_pandas()
print(df.head())
```

## Research Question

**Can we predict whether a reactor is PWR or BWR?**

## Data Wrangling and Cleaning

After cleaning, the final dataset contained **573 rows**.

## Descriptive Statistics and Main Notes

The cleaned dataset still showed class imbalance:

- **PWR:** 483 reactors
- **BWR:** 120 reactors

This means the dataset contains many more PWR reactors than BWR reactors, which may affect classification performance.

## Research Questions, Visualizations, and Answers

### Question 1: Is there a difference in capacity between PWR and BWR reactors?

This question was explored using a bar chart comparing the **mean** and **median** capacity of each reactor type.

![Question 1](q1.png)

**Answer:**  
Yes. PWR reactors generally show higher capacity values than BWR reactors.  
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.

### Question 2: Are PWR and BWR reactors distributed differently across geographic locations?

This question was explored using a **world map** based on latitude and longitude.

![Question 2](q2.png)

**Answer:**  
The map shows that nuclear reactors are highly concentrated near coastlines.  
There is some geographic difference between PWR and BWR reactors, but not a perfect separation.  
For example, many reactors in Russia and nearby regions appear to be PWR, and China also shows many PWR reactors.

In general, the map suggests two visible geographic blocs: one around the United States and another around Russia/China.  
This pattern is not perfectly sharp, but it is visible enough to suggest that geographic location may contain useful predictive information.

### Question 3: Which countries contain the highest numbers of PWR and BWR reactors?

This question was explored using a **stacked bar chart** of reactor counts by country and reactor type.

![Question 3](q3.png)

**Answer:**  
The United States and China appear to have the highest numbers of reactors, followed by countries such as Japan and France.  
Russia appears lower than expected in this dataset maybe because of Chernobyl.  
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.

### Question 4: How does the total global capacity compare between PWR and BWR reactors?

This question was explored using a **bar chart** of total capacity by reactor type.

![Question 4](q4.png)

**Answer:**  
PWR reactors contribute much more total global capacity than BWR reactors in this dataset.  
This matches the earlier findings that PWR reactors are both more common and usually larger in capacity.

## Main Insights

The main findings of the exploratory analysis were:

- **Capacity** was the most informative feature in the dataset.
- Geographic location was useful, but not strong enough on its own.
- There was no single feature that perfectly separated PWR and BWR reactors.
- The classification task seems to depend on a **combination of several features together**, not on one perfect variable.

## Decisions Made During the Analysis

Several important decisions were made during the project:

- I decided to focus only on **PWR** and **BWR** reactors.
- I removed rows with missing values in important columns.
- I removed rows with missing coordinates because location was relevant to the research question.
- I filled missing values in `Capacity` using the median.
- I checked skewness in `Capacity`, but did not apply transformation because the skewness was moderate and not extreme.
- I compared several models before selecting the final one.

## Modeling

The target variable was:

- **ReactorType**
  - `0 = BWR`
  - `1 = PWR`

The main engineered and selected features included:

### Numeric features
- Capacity
- Latitude
- Longitude
- AbsLatitude
- ConstructionYear
- OperationalYear
- YearsToOperation
- ReactorAge

## got to say that at first i used only capacity and the cordinates.
## after that i improved my model with the other features

### Categorical features
- Status
- Country
- CountryCode

The following models were tested:

- Logistic Regression
- Balanced Logistic Regression
- Random Forest
- Gradient Boosting

## Model Results

The best model was **Random Forest**.

### Best Model: Random Forest

- **Accuracy:** 0.8957
- **Macro F1-score:** 0.8467
- **BWR Recall:** 0.7917
- **PWR Recall:** 0.9231

**Interpretation:**  
Random Forest performed better than the other models because it was able to capture more complex patterns in the data.  
It also gave the best balance between overall performance and detection of both reactor types.

## Limitations

This project has several limitations:

- Some useful variables originally had missing values.
- The dataset is imbalanced, with many more PWR reactors than BWR reactors.
- Geographic coordinates alone do not clearly separate the two reactor types.
- Some interesting geographic or political patterns may exist, but they would require further research beyond this dataset.

## Final Conclusion

This project showed that it is possible to predict whether a nuclear reactor is PWR or BWR with good performance.

The exploratory analysis showed that **Capacity** is the strongest single feature, while geographic location and country also provide useful information.  
However, no single feature perfectly separates the two classes.

Among all tested models, **Random Forest** gave the best results and was selected as the final model.