xuyang1706 commented on a change in pull request #8632: [FLINK-12744][ml] add
shared params in ml package
URL: https://github.com/apache/flink/pull/8632#discussion_r293830121
##########
File path:
flink-ml-parent/flink-ml-api/src/main/java/org/apache/flink/ml/api/misc/param/Params.java
##########
@@ -69,20 +133,11 @@
* evaluated as illegal by the validator
*/
public <V> Params set(ParamInfo<V> info, V value) {
- if (!info.isOptional() && value == null) {
- throw new RuntimeException(
- "Setting " + info.getName() + " as null while
it's not a optional param");
- }
- if (value == null) {
- remove(info);
- return this;
- }
-
if (info.getValidator() != null &&
!info.getValidator().validate(value)) {
throw new RuntimeException(
"Setting " + info.getName() + " as a invalid
value:" + value);
}
- paramMap.put(info.getName(), value);
+ params.put(info.getName(), valueToJson(value));
Review comment:
If we changed ParamInfo name, we can add the old name to aliases, thus, when
we get params from old json, we could also get the param value.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services