Skip to content

DOC: add Snap ML example#1426

Merged
hirzel merged 8 commits into
IBM:masterfrom
AmirhosseinHonardoust:docs-snap-ml-example
May 21, 2026
Merged

DOC: add Snap ML example#1426
hirzel merged 8 commits into
IBM:masterfrom
AmirhosseinHonardoust:docs-snap-ml-example

Conversation

@AmirhosseinHonardoust

Copy link
Copy Markdown
Contributor

This PR adds a simple code example to the lale.lib.snapml module documentation.
The example shows how to use SnapLogisticRegression with a scikit-learn binary classification dataset, train/test split, prediction, and accuracy evaluation.
Related issue: #1368

Signed-off-by: Amir <88084572+AmirhosseinHonardoust@users.noreply.github.com>
@hirzel

hirzel commented May 11, 2026

Copy link
Copy Markdown
Member

Hi Amir, thank you for your PR. However, I have a couple of concerns with it.

  • First, the added example doesn't use features that Lale adds beyond scikit-learn. As it stands, it would be simpler to just point to the tests.
  • Second, it also doesn't use a markdown code block, so I suspect Sphinx may not render it nicely. Did you try how it gets rendered?

AmirhosseinHonardoust and others added 5 commits May 12, 2026 02:23
Updated the SnapML example to demonstrate pipeline composition and schema validation, using a Sphinx code block for proper rendering.

Signed-off-by: AmirhosseinHonardoust <88084572+AmirhosseinHonardoust@users.noreply.github.comgit config --global user.name AmirhosseinHonardoustgit config --global user.email 88084572+AmirhosseinHonardoust@users.noreply.github.com>
Updated the SnapML example to demonstrate pipeline composition and schema validation, using a Sphinx code block for proper rendering.
Signed-off-by: Amirhossein Honardoust <88084572+AmirhosseinHonardoust@users.noreply.github.com>
Signed-off-by: AmirhosseinHonardoust <88084572+AmirhosseinHonardoust@users.noreply.github.comgit config --global user.name AmirhosseinHonardoustgit config --global user.email 88084572+AmirhosseinHonardoust@users.noreply.github.com>
Signed-off-by: Amir <88084572+AmirhosseinHonardoust@users.noreply.github.com>
Signed-off-by: AmirhosseinHonardoust <88084572+AmirhosseinHonardoust@users.noreply.github.comgit config --global user.name AmirhosseinHonardoustgit config --global user.email 88084572+AmirhosseinHonardoust@users.noreply.github.com>
Updated the SnapML example to demonstrate pipeline composition and schema validation, using a Sphinx code block for proper rendering.

Signed-off-by: Amir <amirhosseinhonardoust@gmail.com>
Signed-off-by: AmirhosseinHonardoust <88084572+AmirhosseinHonardoust@users.noreply.github.comgit config --global user.name AmirhosseinHonardoustgit config --global user.email 88084572+AmirhosseinHonardoust@users.noreply.github.com>
Signed-off-by: Amir <88084572+AmirhosseinHonardoust@users.noreply.github.com>
Signed-off-by: AmirhosseinHonardoust <88084572+AmirhosseinHonardoust@users.noreply.github.comgit config --global user.name AmirhosseinHonardoustgit config --global user.email 88084572+AmirhosseinHonardoust@users.noreply.github.com>
@AmirhosseinHonardoust

Copy link
Copy Markdown
Contributor Author

Hi @hirzel ,

I updated the SnapML example to clearly demonstrate lale-specific features:

  • pipeline composition using make_pipeline()
  • Schema validation with pipe.print_schema()
  • proper Sphinx code block formatting for documentation rendering

additionally, I rebased all commits to include Signed-off-by lines, so the DCO check now passes. I also verified locally that the SnapML documentation page renders correctly.

thank you for reviewing

@hirzel

hirzel commented May 13, 2026

Copy link
Copy Markdown
Member
  • proper Sphinx code block formatting for documentation rendering: Thanks, that's a useful improvement!
  • pipeline composition using make_pipeline(): Since you are using only a single operator, having a pipeline here is overkill.
  • Schema validation with pipe.print_schema(): The print_schema method does not exist. Was it hallucinated by an LLM? Please make sure the code example actually works!

Signed-off-by: AmirhosseinHonardoust <88084572+AmirhosseinHonardoust@users.noreply.github.com>
Signed-off-by: Amir <88084572+AmirhosseinHonardoust@users.noreply.github.com>
@AmirhosseinHonardoust

Copy link
Copy Markdown
Contributor Author

Thank you @hirzel for the feedback. You were right: print_schema() does not exist, and using make_pipeline() with a single operator was unnecessary.

I revised the example to keep it as a single SnapLogisticRegression operator while showing a Lale specific feature via get_schema("hyperparams"). I also kept the Sphinx .. code-block:: python formatting.
Furthermore, I tested the example locally and confirmed that it runs successfully.

@hirzel

hirzel commented May 21, 2026

Copy link
Copy Markdown
Member

Thanks! The code looks good now. There is one more piece of housekeeping. Could you please sign a DCO as outlined in contributing.md? You can email it to me: hirzel at us dot ibm dot com.

@hirzel

hirzel commented May 21, 2026

Copy link
Copy Markdown
Member

The static checks revealed a problem in the black pretty-printer. This should be easy to resolve by running the pre-commit checks, as documented in contributing.md.

Signed-off-by: AmirhosseinHonardoust <88084572+AmirhosseinHonardoust@users.noreply.github.comgit config --global user.name AmirhosseinHonardoustgit config --global user.email 88084572+AmirhosseinHonardoust@users.noreply.github.com>
Signed-off-by: Amir <amirhosseinhonardoust@gmail.com>
@AmirhosseinHonardoust

Copy link
Copy Markdown
Contributor Author

The Snap ML module has been reformatted using Black to ensure consistent and PEP8 compliant code style across the project.

@hirzel hirzel merged commit c751b3a into IBM:master May 21, 2026
45 checks passed
@hirzel

hirzel commented May 21, 2026

Copy link
Copy Markdown
Member

Thank you for your contribution!

@AmirhosseinHonardoust AmirhosseinHonardoust deleted the docs-snap-ml-example branch May 22, 2026 08:15
@AmirhosseinHonardoust

Copy link
Copy Markdown
Contributor Author

Thank you @hirzel for reviewing and merging my PR. I appreciate your guidance throughout the process.

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.

2 participants