Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Support PyTensor deterministic operations as observations#7656

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ricardoV94 merged 14 commits intopymc-devs:mainfromwilliambdean:data-as-observed
Feb 27, 2025

Conversation

@williambdean
Copy link
Contributor

@williambdeanwilliambdean commentedJan 24, 2025
edited
Loading

Description

Will need some help on this implementation and how to best test this.

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚:https://pymc--7656.org.readthedocs.build/en/7656/

ricardoV94 reacted with thumbs up emoji
@ricardoV94
Copy link
Member

We need to tell InferenceData converter how to get the data values to put inconstant_data, andobserved_data. It had some hardcode logic assuming you could only due Casts

williambdean reacted with thumbs up emoji

@ricardoV94
Copy link
Member

I don't consider this a bugfix, it's behavior that was explicitly forbidden for conservative reasons (more like a NotImplementedError)

@williambdean
Copy link
ContributorAuthor

We need to tell InferenceData converter how to get the data values to put inconstant_data, andobserved_data. It had some hardcode logic assuming you could only due Casts

Where does this happen in the code?

@williambdean
Copy link
ContributorAuthor

I think the MiniBatch tests will still fail. Any thoughts on how that should behave?

@williambdean
Copy link
ContributorAuthor

Also, feel free to choose a better title! I couldn't express it too well

@ricardoV94
Copy link
Member

ricardoV94 commentedJan 25, 2025
edited
Loading

We need to tell InferenceData converter how to get the data values to put inconstant_data, andobserved_data. It had some hardcode logic assuming you could only due Casts

Where does this happen in the code?

obs_data=extract_obs_data(aux_obs)

defextract_obs_data(x:TensorVariable)->np.ndarray:

We should be able to just use constant_fold (also in pytensor) for it

@ricardoV94ricardoV94 changed the titleSupport ops to pm.Data in observed variablesSupport pytensor deterministic operations as observationsJan 25, 2025
@ricardoV94ricardoV94 changed the titleSupport pytensor deterministic operations as observationsSupport PyTensor deterministic operations as observationsJan 25, 2025
@williambdean
Copy link
ContributorAuthor

We should be able to just use constant_fold (also in pytensor) for it

I have an implementation before this suggestion. I need a little help understanding this. Feel free to put suggestion

@ricardoV94
Copy link
Member

We should be able to just use constant_fold (also in pytensor) for it

I have an implementation before this suggestion. I need a little help understanding this. Feel free to put suggestion

What do you mean? My suggestion is to simply call constant_fold on the observed variable

@williambdean
Copy link
ContributorAuthor

williambdean commentedJan 28, 2025
edited
Loading

I am not able to make this work with eitherconstant_fold(x) orconstant_fold([x]). Both return errors. Is the constant_fold from pymc.pytensorf or from pytensor?

@ricardoV94
Copy link
Member

I am not able to make this work with eitherconstant_fold(x) orconstant_fold([x]). Both return errors. Is the constant_fold from pymc.pytensorf or from pytensor?

From pymc.pytensorf. There's araise_if_not_constant flag you can set, but what cases is it failing?

@ricardoV94
Copy link
Member

Ah if it's a SharedVariable likepm.Data of course constant_fold is not going to work... Dummy me.

@ricardoV94
Copy link
Member

ricardoV94 commentedJan 28, 2025
edited
Loading

frompytensor.compile.modeimportModeimportpymcaspmwithpm.Model(coords={"date": [0,1,2]})asm:data=pm.Data("data", [0,1,2],dims="date")x=pm.Normal("x")y=pm.Normal("y",x,observed=data,dims="date")cheap_eval_mode=Mode(linker="py",optimizer=None)m.rvs_to_values[y].eval(mode=cheap_eval_mode)# array([0., 1., 2.])
williambdean reacted with thumbs up emoji

@williambdean
Copy link
ContributorAuthor

Thanks for the suggestion. I've used mode on the random variable directly. Is it different to get the rvs_to_values from the model? it currently isn't accessed from the function at the moment.

@williambdean
Copy link
ContributorAuthor

Could you point me to similar tests for this?

@williambdean
Copy link
ContributorAuthor

I've just added to associated pytensorf test suite

@williambdeanwilliambdean deleted the data-as-observed branchFebruary 27, 2025 10:50
vandalt pushed a commit to vandalt/pymc that referenced this pull requestMay 14, 2025
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJun 29, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJun 29, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJun 30, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJun 30, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJun 30, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJun 30, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJun 30, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJun 30, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 2, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 3, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 3, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 3, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 3, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 3, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 3, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 8, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 8, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 8, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 11, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 11, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 11, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 11, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 11, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 14, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit to ricardoV94/pymc that referenced this pull requestJul 22, 2025
* Use RV Op name when provided* More robust detection of observed data variables (afterpymc-devs#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closespymc-devs#7722)
ricardoV94 added a commit that referenced this pull requestJul 22, 2025
* Use RV Op name when provided* More robust detection of observed data variables (after#7656 arbitrary graphs are allowed)* Remove self loops explicitly (closes#7722)
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ricardoV94ricardoV94ricardoV94 approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

BUG: data as observed in RV

3 participants

@williambdean@ricardoV94@cetagostini

[8]ページ先頭

©2009-2025 Movatter.jp