Skip to content

Feature/sklearn method pluggin#31

Merged
kparasch merged 5 commits intokparasch:developfrom
i-a-morozov:feature/sklearn-method-pluggin
Mar 30, 2026
Merged

Feature/sklearn method pluggin#31
kparasch merged 5 commits intokparasch:developfrom
i-a-morozov:feature/sklearn-method-pluggin

Conversation

@i-a-morozov
Copy link
Copy Markdown

Added support for sklearn-like method passing to injection/orbit correction

Custom solver protocol:

class Solver:
    coef_: np.ndarray
    def fit(self, X: np.ndarray, y: np.ndarray):
         ...

Example with sklearn (should match parameter=100.0)

from sklearn.linear_model import Ridge
solver = Ridge(
    alpha=arguments.injection_regularization**2,
    fit_intercept=False,
    solver="svd"
)

...

sc.tuning.correct_injection(
    solver=solver,
    n_reps=arguments.injection_number_of_repetitions,
    n_turns=arguments.injection_number_of_turns,
    gain=arguments.injection_gain
)

Copy link
Copy Markdown
Owner

@kparasch kparasch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea! I made some comments where we can simplify a bit.

Also could you rebase to the develop branch and remove commit d47440c which is related to the other PR?

@kparasch kparasch changed the base branch from main to develop March 30, 2026 12:18
@i-a-morozov i-a-morozov force-pushed the feature/sklearn-method-pluggin branch from 240c4bd to e30fd59 Compare March 30, 2026 12:48
@i-a-morozov i-a-morozov force-pushed the feature/sklearn-method-pluggin branch from 9a59ce0 to 56cc089 Compare March 30, 2026 13:44
@i-a-morozov i-a-morozov requested a review from kparasch March 30, 2026 13:59
Copy link
Copy Markdown
Owner

@kparasch kparasch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!

@kparasch
Copy link
Copy Markdown
Owner

I just merged some workflows to run both pySC and pyAML tests that are related to pySC. I will merge them also to this PR to make sure pyaml doesn't break, and then do the final merge.

workflow for tests, including testing for pyAML (related to pySC)
@i-a-morozov
Copy link
Copy Markdown
Author

i-a-morozov commented Mar 30, 2026

Great, nice to have tests! I'll be doing next PRs with develop as origin.

@kparasch kparasch merged commit 4265b27 into kparasch:develop Mar 30, 2026
5 checks passed
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