Skip to content

[ENH] EmpiricalFitter distribution fitter - #1095

Open
utsab345 wants to merge 7 commits into
sktime:mainfrom
utsab345:feature/empirical-fitter
Open

[ENH] EmpiricalFitter distribution fitter#1095
utsab345 wants to merge 7 commits into
sktime:mainfrom
utsab345:feature/empirical-fitter

Conversation

@utsab345

@utsab345 utsab345 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #1087.

Adds EmpiricalFitter which converts the full sample into an Empirical distribution. For the univariate case (empirical per variable), it simply wraps the data in an Empirical distribution.

Supports single-column and multi-column data, with a time_indep parameter passed through to Empirical.

Useful as a base component for naive distribution fitting in ensemble or reduction strategies.

Adds EmpiricalFitter which converts the full sample into an Empirical
distribution. For the univariate case (empirical per variable), it
simply wraps the data in an Empirical distribution.

Useful as a base component for naive distribution fitting in ensemble
or reduction strategies.
@fkiraly fkiraly changed the title Add EmpiricalFitter distribution fitter [ENH] EmpiricalFitter distribution fitter Jul 2, 2026
@fkiraly fkiraly added enhancement module:distributions&simulation probability distributions and simulators implementing algorithms Implementing algorithms, estimators, objects native to skpro labels Jul 2, 2026

@fkiraly fkiraly left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this is not correct, since the result should be an 0D distribution, but it is a 2D distribution.

@fkiraly

fkiraly commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

please ensure to fix code quality failures too. Please look at the developer guide.

utsab345 added 2 commits July 3, 2026 06:30
…tion

Previously, multi-column data was reshaped into a 2D Empirical distribution
via MultiIndex, which violated the contract that proba() must return a
scalar (0D) distribution. Now all values are raveled into a single-column
DataFrame, producing a scalar distribution regardless of input shape.
@utsab345

utsab345 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Fixed as per your review: _fit now flattens multi-column data via X.values.ravel() into a single-column DataFrame so proba() always returns a 0D Empirical distribution. Also ran pre-commit hooks — black, isort, flake8, pydocstyle all passed.

Comment thread skpro/distfitter/_empiricalfitter.py Outdated
"""

_tags = {
"authors": ["fkiraly"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you are the author for this class

Comment thread skpro/distfitter/_empiricalfitter.py Outdated
}

def __init__(self, time_indep=True):
self.time_indep = time_indep

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is no need for this as we are flattening the data so this time_indep is going to make no difference as there is going to be an single row

@utsab345

Copy link
Copy Markdown
Contributor Author

Addressed review feedback:

  • Fixed _tags authors to utsab345
  • Removed time_indep parameter — since _fit flattens all data via X.values.ravel(), only a single column is passed to Empirical, making time_indep a no-op
  • Removed custom __init__ (inherited one suffices)
  • Updated \_proba() and get_test_params accordingly
  • All linting (black, isort, flake8, pydocstyle) and tests pass

@utsab345
utsab345 requested a review from fkiraly August 5, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement implementing algorithms Implementing algorithms, estimators, objects native to skpro module:distributions&simulation probability distributions and simulators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] EmpiricalFitter distribution fitter

3 participants