Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata for wrap_fit when using GPU dataframes #317

Closed
wants to merge 3 commits into from

Conversation

ChrisJar
Copy link
Collaborator

Enables using CREATE MODEL with gpu dataframes and wrap_fit=True. Depends on dask-ml/#862.

@charlesbluca
Copy link
Collaborator

@ChrisJar it looks like dask/dask-ml#862 is in - is this ready to review?

@ChrisJar ChrisJar marked this pull request as ready for review November 19, 2021 20:25
@VibhuJawa
Copy link
Collaborator

I think this PR is no longer needed as now with this state of dask-ml below should just work as the default now is infer for predict . See doc-string here .

That is below works now:

df = timeseries(freq="1d").reset_index(drop=True).compute()
df = cudf.from_pandas(df)
df['target'] = df['x']*df['y'] > 0

model = cuml.linear_model.LinearRegression()
model.fit(df[['x','y']], df['target'])

dask_model = dask_model = ParallelPostFit(model)
dask_cudf_df = dask_cudf.from_cudf(df, npartitions=2)
dask_model.predict(dask_cudf_df[['x','y']]).compute()

@VibhuJawa
Copy link
Collaborator

Can confirm below query with cuML and dask-cuDF now just works. :-D

model_query = '''
CREATE OR REPLACE MODEL my_model WITH (
    model_class = 'cuml.linear_model.LogisticRegression',
    wrap_predict = True,
    wrap_fit = False,
    target_column = 'target'
) AS (
    SELECT x, y, x*y > 0 AS target
    FROM timeseries
)
'''
predict_sql = """
        SELECT * FROM PREDICT(
            MODEL my_model,
            SELECT x, y FROM timeseries
        )
        """
df = timeseries(freq="1d").reset_index(drop=True).compute()
df = cudf.from_pandas(df)
df = dask_cudf.from_cudf(df, npartitions=2)
c.create_table('timeseries',input_table=df)


c.sql(model_query)
c.sql(predict_sql).compute()

@ChrisJar
Copy link
Collaborator Author

Awesome, thanks for letting me know. I'll close this PR

@ChrisJar ChrisJar closed this Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants