Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.9", "3.11", "3.12", "3.13"] #future: "3.14"
steps:
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: Unix",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
Expand Down
6 changes: 3 additions & 3 deletions stemflow/model/AdaSTEM.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,13 +944,13 @@ def find_belonged_points_and_predict(df, st_indexes_df, X_df):
"stixel_calibration_point_transformed_upper_bound",
]
]
.groupby(["ensemble_index", "unique_stixel_id"], as_index=False)
.groupby(["ensemble_index", "unique_stixel_id"], as_index=False, group_keys=False)
.pipe(lambda x: x[x.obj.columns]) # Explicitly select all the columns in the original df to include. To overcome the include_groups=True deprecation warning
.apply(find_belonged_points_and_predict, st_indexes_df=window_X_df_indexes_only, X_df=window_X_df, include_groups=False) # although ["ensemble_index", "unique_stixel_id"] will be passed into `find_belonged_points` due to `.pipe(lambda x: x[x.obj.columns])`, the output will not have them so we still set `as_index=True` in `groupby`
)

if len(res)>0:
res = res.droplevel(0) # If using as_index=False duing groupby, pandas will automatically generate a group indexing column, so drop the indexing of the new groups
# if len(res)>0:
# res = res.droplevel(0) # If using as_index=False duing groupby, pandas will automatically generate a group indexing column, so drop the indexing of the new groups

window_prediction_list.append(res)

Expand Down
7 changes: 4 additions & 3 deletions stemflow/model/SphereAdaSTEM.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,17 +513,18 @@ def find_belonged_points(df, st_indexes_df, X_df):
window_prediction = (
query_results
.dropna(subset="unique_stixel_id")
.groupby("unique_stixel_id", as_index=False)
.groupby("unique_stixel_id", as_index=False, group_keys=False)
.pipe(lambda x: x[x.obj.columns])
.apply(lambda stixel: self.stixel_predict(stixel), include_groups=False)
.droplevel(0)
)
# print('window_prediction:',window_prediction)
window_prediction_list.append(window_prediction)

if any([i is not None for i in window_prediction_list]):
ensemble_prediction = pd.concat(window_prediction_list, axis=0)
ensemble_prediction = ensemble_prediction.groupby("index").mean().reset_index(drop=False)
ensemble_prediction = ensemble_prediction.groupby(level=0).mean()
ensemble_prediction.index.name = "index"
ensemble_prediction = ensemble_prediction.reset_index(drop=False)
else:
ensmeble_index = list(window_single_ensemble_df["ensemble_index"])[0]
warnings.warn(f"No prediction for this ensemble: {ensmeble_index}")
Expand Down