Spaces:
Sleeping
Sleeping
fschwartzer
commited on
Commit
·
69d0d2d
1
Parent(s):
19af976
Update app.py
Browse files
app.py
CHANGED
@@ -255,13 +255,10 @@ def bootstrap_stats(predicted_target, num_samples=1000):
|
|
255 |
bootstrapped_means.append(np.mean(bootstrap_sample))
|
256 |
|
257 |
# Calculate lower and higher bounds
|
258 |
-
lower_bound = np.percentile(bootstrapped_means,
|
259 |
-
higher_bound = np.percentile(bootstrapped_means,
|
260 |
|
261 |
-
|
262 |
-
mean_value = np.mean(bootstrapped_means)
|
263 |
-
|
264 |
-
return lower_bound, higher_bound, mean_value
|
265 |
|
266 |
# Apply KNN and get predicted Predicted_target values
|
267 |
predicted_target = knn_predict(filtered_data, 'Predicted_target', ['latitude', 'longitude', 'area_feature'])
|
@@ -269,10 +266,12 @@ predicted_target = knn_predict(filtered_data, 'Predicted_target', ['latitude', '
|
|
269 |
# Check if there are predictions to display
|
270 |
if 'Predicted_target' in filtered_data.columns and not np.all(predicted_target == 0):
|
271 |
# Add predicted Predicted_target values to filtered_data
|
272 |
-
filtered_data['
|
273 |
|
274 |
# Apply bootstrap on the predicted values
|
275 |
-
lower_bound, higher_bound
|
|
|
|
|
276 |
|
277 |
# Display the results with custom styling
|
278 |
st.markdown("## **Resultado da Análise Estatística**")
|
|
|
255 |
bootstrapped_means.append(np.mean(bootstrap_sample))
|
256 |
|
257 |
# Calculate lower and higher bounds
|
258 |
+
lower_bound = np.percentile(bootstrapped_means, 25.)
|
259 |
+
higher_bound = np.percentile(bootstrapped_means, 75.)
|
260 |
|
261 |
+
return lower_bound, higher_bound
|
|
|
|
|
|
|
262 |
|
263 |
# Apply KNN and get predicted Predicted_target values
|
264 |
predicted_target = knn_predict(filtered_data, 'Predicted_target', ['latitude', 'longitude', 'area_feature'])
|
|
|
266 |
# Check if there are predictions to display
|
267 |
if 'Predicted_target' in filtered_data.columns and not np.all(predicted_target == 0):
|
268 |
# Add predicted Predicted_target values to filtered_data
|
269 |
+
filtered_data['target_column'] = bound_data
|
270 |
|
271 |
# Apply bootstrap on the predicted values
|
272 |
+
lower_bound, higher_bound = bootstrap_stats(bound_data)
|
273 |
+
|
274 |
+
mean_value = np.mean(filtered_data['Predicted_target'])
|
275 |
|
276 |
# Display the results with custom styling
|
277 |
st.markdown("## **Resultado da Análise Estatística**")
|