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

Equivalency between 2 models/agents. #612

Closed
MridulS opened this issue Apr 7, 2020 · 7 comments
Closed

Equivalency between 2 models/agents. #612

MridulS opened this issue Apr 7, 2020 · 7 comments

Comments

@MridulS
Copy link
Member

MridulS commented Apr 7, 2020

Should HARK have the __eq__ method to compare 2 HARK objects?

For example

example_1 = PerfForesightConsumerType(**PF_params)
example_2 = PerfForesightConsumerType(**PF_params)

example_1 == example_2 should be True (it will give it False) but currently HARK doesn't have the ability to test this.

@sbenthall
Copy link
Contributor

That sounds nice.

A couple thoughts:

  • The distanceMetric functionality seems to do some of this. That functionality is old code. It could probably be reimplemented in a more pythonic way. Maybe that would be connected to this issue.
  • Would an unsolved and a solved AgentType be equivalent? What if a simulation had been ran, with different parameters? The meaning of 'equivalence' might be more intuitive if some of the functionalities currently handled in AgentType were disentangled, see Disentangle solution and simulation frameworks in HARK.core and downstream classes #495

@MridulS
Copy link
Member Author

MridulS commented Apr 7, 2020

Would an unsolved and a solved AgentType be equivalent? What if a simulation had been ran, with different parameters? The meaning of 'equivalence' might be more intuitive if some of the functionalities currently handled in AgentType were disentangled, see #495

Different parameters should mean the agent are not equivalent. There isn't any way to get all the parameters of an agent right? something like AgentType.parameters

@mnwhite
Copy link
Contributor

mnwhite commented Apr 7, 2020 via email

@sbenthall
Copy link
Contributor

There isn't any way to get all the parameters of an agent right? something like AgentType.parameters

I don't believe there is.
But this is high on my refactoring wishlist.

It's a little complicated to do this... see #492

@sbenthall
Copy link
Contributor

#760 #761 are related

@sbenthall sbenthall added this to the 1.0.0 milestone Jul 23, 2020
@sbenthall
Copy link
Contributor

See also #660

@sbenthall
Copy link
Contributor

distanceMetric is used for comparing solutions, to see if it has converged on successive iterations. I'm not sure there's a use case for comparing instances of AgentType subclasses for equality.

This makes sense to me.

I have wondered for a while why AgentType inherits from HARKObject, since there is no use case for using its distanceMetric function.

I think what it's using currently is assignParameters.

Does assignParameters ever get used on a solution object? If not, then I think it would be safe to split HARKObject into two classes.

It would be safe to do that anyway, since the two classes can be combined with multiple inheritance when necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants