Bug(?): mlpregressor~'s "Name" attribute not responding

Hi,

I am trying to give the fluid.mlpregressor~'s model a new custom name (e.g. my_model), but it seems to maintain its randomly generated name (e.g. “u916001438”). Is this a bug, or a mistake from my side? Thanks! Francesco

Hi,

The @name attribute is read only after object instantiation. It can be set ‘in the box’ as an argument, like [fluid.mlpregressor~ my_model], otherwise it will use the generated name (much like jit.mat or dict).

If you need to dynamically refer to other named fluid.mlpregressor objects, you can call the refer message.

(
I might consider, in the future, setting @name act as a synonym to refer, which would make it behave more like dict. However, I’ve never found dict to be especially friendly in this respect: if you change its @name, what happens is that you actually destroy the dict you were talking to (and its data) unless there happens to be another dict box somewhere with that name. Something of a footgun, IMO!
)

Hi again @weefuzzy, thank you for your reply.

I am attaching the max patch for you to see what I mean with this.
Let’s say I want to load multiple fluid.mlpregressor~, and automate the naming using either the attrui object or use “prepend name” in combination with either #0_my_model or #1 … would that be possible with the object’s current architecture?

Thank you,
Francesco

test-mlpregressor~2.maxpat (15.7 KB)

it is possible to ‘load’ and ‘dump’ to dictionaries. This is the way I’ve seen many people ‘save’ states of objects like mlpregressor.

1 Like

Because #0 and #1 are resolved at patcher-load, it’s possible to use them in literals in boxes, yes.

So, just using #0, and saving as an abstraction:
Screenshot 2022-10-29 at 14.24.34

and then using that abstraction:

the object gets given a programmatically controllable name.

2 Likes

Fantastic! I was able to reproduce.

Many thanks. It is an amazing object to work with.