The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
package protection of attribute constructor
Hi,
I would like to extent some of the attribute classes (e.g NumericalAttribute) but the constructors are package protected. Even if I define the extension in the same package (but in my plug-in jar) I get an access exception at run time calling the constructor (may be some issue with the class loader?).
Does anyone has a solution for that problem?
Thanks,
Dirk
I would like to extent some of the attribute classes (e.g NumericalAttribute) but the constructors are package protected. Even if I define the extension in the same package (but in my plug-in jar) I get an access exception at run time calling the constructor (may be some issue with the class loader?).
Does anyone has a solution for that problem?
Thanks,
Dirk
Tagged:
0
Answers
I cannot explain why this (i.e. the difference between compile- and runtime) happens, but I have a feeling in my stomach that renaming one's own package to get access to package-proctected constructors is ... hm ... evil or at least wrong.
My "solution": NumericalAttribute does not do that much complicated stuff, hence I would extend AbstractAttribute instead and do some copy & pasting if necessary.
hope this was helpful,
steffen
edit: edited the source of confusion
the behaviour you are describing is just as expected for package private methods. Actually, these classes are protected is because some operators assume that there is only a well-defined universe of attribute types. Why exactly do you need a new one?
Best,
Simon
Thanks,
Dirk
An idea from my side ...
Once I wrote a plugin to do some kind of image classification. Since I also wanted to do the preprocessing and feature generation steps in rapidminer, I was in a similar situation. I did the following ...
- During the loading of the images I created a map which hold all images (i.e. their current state). The object was assigned to a static field. Additionally I created an ExampleSet where the id of the set correspond to the id of the mentioned map.
- Whenever a custom operator needed to process images, it read the id from the set and loaded the image from the map.
- If an operator has changed an image, the map was updated accordingly
- By listening to the process (as far as I remember), I have ensured that the image-data is dropped when a process finishes
This way I could use e.g. crossvalidation to optimize the preprocessing of images according to the defined label.greetings,
steffen
Let’s take the aggregation operator. It creates new attributes like average(att2), standard_deviation(att3). Later on another operator will create a report that structures the data based on the use aggregation function. The only way to get the information about the aggregation function is by parsing the attribute name. If you have more complex information than the aggregation function in this simple example it gets impossible to encode this information in the attribute name. So I was searching for a way to enrich the current attribute implementation.
Creating a map to hold the information outside the example set / attributes sounds also like a good approach since I only need the information to create the report at the end.
a warning: Be careful with static references. RM 6 will probably allow multiple processes opened, and RapidAnalytics certainly does. Static references will not be thread safe.
Best,
Simon