Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1163,37 +1163,32 @@ with tab2:
|
|
| 1163 |
st.write('Simulating contest on frames')
|
| 1164 |
|
| 1165 |
while SimVar <= Sim_size:
|
| 1166 |
-
|
| 1167 |
-
|
| 1168 |
-
|
| 1169 |
-
|
| 1170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1171 |
np.sum(np.random.normal(
|
| 1172 |
-
loc=
|
| 1173 |
-
scale=
|
| 1174 |
axis=1)
|
| 1175 |
]
|
| 1176 |
-
|
| 1177 |
-
|
| 1178 |
-
|
| 1179 |
-
|
| 1180 |
-
|
| 1181 |
-
|
| 1182 |
-
|
| 1183 |
-
|
| 1184 |
-
]
|
| 1185 |
-
sample_arrays = np.vstack((sample_arrays1, sample_arrays2))
|
| 1186 |
-
else:
|
| 1187 |
-
sample_arrays = sample_arrays1
|
| 1188 |
-
|
| 1189 |
-
final_array = sample_arrays[sample_arrays[:, 10].argsort()[::-1]]
|
| 1190 |
-
best_lineup = final_array[final_array[:, -1].argsort(kind='stable')[::-1][:1]]
|
| 1191 |
-
Sim_Winners.append(best_lineup)
|
| 1192 |
-
SimVar += 1
|
| 1193 |
-
|
| 1194 |
-
except Exception as e:
|
| 1195 |
-
# Handle exceptions here but avoid using try-except for control flow
|
| 1196 |
-
print("Exception: ", e)
|
| 1197 |
|
| 1198 |
|
| 1199 |
# del smple_arrays
|
|
|
|
| 1163 |
st.write('Simulating contest on frames')
|
| 1164 |
|
| 1165 |
while SimVar <= Sim_size:
|
| 1166 |
+
fp_random = fp_array[np.random.choice(fp_array.shape[0], Contest_Size-len(CleanPortfolio), replace=False)]
|
| 1167 |
+
|
| 1168 |
+
sample_arrays1 = np.c_[
|
| 1169 |
+
fp_random,
|
| 1170 |
+
np.sum(np.random.normal(
|
| 1171 |
+
loc=vec_projection_map(fp_random[:, :-5]),
|
| 1172 |
+
scale=vec_stdev_map(fp_random[:, :-5])),
|
| 1173 |
+
axis=1)
|
| 1174 |
+
]
|
| 1175 |
+
|
| 1176 |
+
if insert_port == 1:
|
| 1177 |
+
sample_arrays2 = np.c_[
|
| 1178 |
+
up_array,
|
| 1179 |
np.sum(np.random.normal(
|
| 1180 |
+
loc=vec_up_projection_map(up_array[:, :-5]),
|
| 1181 |
+
scale=vec_up_stdev_map(up_array[:, :-5])),
|
| 1182 |
axis=1)
|
| 1183 |
]
|
| 1184 |
+
sample_arrays = np.vstack((sample_arrays1, sample_arrays2))
|
| 1185 |
+
else:
|
| 1186 |
+
sample_arrays = sample_arrays1
|
| 1187 |
+
|
| 1188 |
+
final_array = sample_arrays[sample_arrays[:, 10].argsort()[::-1]]
|
| 1189 |
+
best_lineup = final_array[final_array[:, -1].argsort(kind='stable')[::-1][:1]]
|
| 1190 |
+
Sim_Winners.append(best_lineup)
|
| 1191 |
+
SimVar += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1192 |
|
| 1193 |
|
| 1194 |
# del smple_arrays
|