Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix: NullIndex in ML model.predict error #917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2024
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
3 changes: 2 additions & 1 deletion 3 bigframes/ml/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def _apply_ml_tvf(

result_sql = apply_sql_tvf(input_sql)
df = self._session.read_gbq(result_sql, index_col=index_col_ids)
df.index.names = index_labels
if df._has_index:
df.index.names = index_labels
# Restore column labels
df.rename(
columns={
Expand Down
10 changes: 9 additions & 1 deletion 10 tests/system/large/ml/test_linear_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_linear_regression_customized_params_fit_score(
assert reloaded_model.learning_rate == 0.2


def test_unordered_mode_regression_configure_fit_score(
def test_unordered_mode_linear_regression_configure_fit_score_predict(
unordered_session, penguins_table_id, dataset_id
):
model = bigframes.ml.linear_model.LinearRegression()
Expand Down Expand Up @@ -154,6 +154,14 @@ def test_unordered_mode_regression_configure_fit_score(
assert reloaded_model.max_iterations == 20
assert reloaded_model.tol == 0.01

pred = reloaded_model.predict(df)
utils.check_pandas_df_schema_and_index(
pred,
columns=("predicted_body_mass_g",),
col_exact=False,
index=334,
)


# TODO(garrettwu): add tests for param warm_start. Requires a trained model.

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.