The transform classes in Microsoft.ML.Transforms.Text are "internal sealed". Is there any way to access them?

Swati Shah

New member
Joined
Aug 17, 2024
Messages
2
Programming Experience
10+
The transform classes in Microsoft.ML.Transforms.Text are "internal sealed".
For example: OptionalColumnTransform, HashJoiningTransform, UngroupTransform, GroupTransform etc.
Could you please let us know, when these classes will be available for us for development?
Is there any other way to access them presently?
 
Use reflection.

But be aware that your code coide break in the future. Accessing classes and methods that are marked as internal is effectively accessing undocumented APIs. MS can modify their code at any time which might break any deductions and assumptions you might have made with the current version.

Developers will mark things as sealed be because they don't want others from extending or modifying the behavior of those classes. Developers will mark things as internal because they don't want others accessing the classes or methods. Treat internal as if they were private.
 
Anyway, it looks like ML.NET is Open Source with an MIT license:


You could just take the source, modify it so that they are not internal sealed, and then rebuild the code for your own use.

Hmmm... looking closer at those transforms you noted in your original post, they look like they are declared as public sealed not internal sealed as you claimed.
 
Also why would you need the classes to not be sealed? Over the years of object oriented programming, many professionals have learned that aggregation is better than composition. So if you follow that design principle, then it doesn't matter if the transforms are sealed. You would just wrap the tranform with your own class instead of having your class derive from the transforms.
 
I wonder if I was looking at a particular branch of the code that had them declared as public... You are correct that the main branch has them as internal.
 
Back
Top Bottom