H2O is an Open Source, Distributed, Fast & Scalable Machine Learning Platform: Deep Learning, Gradient Boosting (GBM) & XGBoost, Random Forest, Generalized Linear Modeling (GLM with Elastic Net), K-Means, PCA, Generalized Additive Models (GAM), RuleFit, Support Vector Machine (SVM), Stacked Ensembles, Automatic Machine Learning (AutoML), etc.
Then the code:
Grid grid = DKV.getGet("myGrid")
for (GBMParameters param : grid.getParams()) {
/ ... /
}
Will throw exception if Grid is fetched from remote node:
java.lang.ClassCastException: [Lhex.Model$Parameters; cannot be cast to [Lhex.tree.gbm.GBMModel$GBMParameters;
The problem is that, Icer code does not reflect generics parameters
and generates common code for generics' upper bound:
class hex.grid.Grid$Icer extends water.Lockable$Icer {
protected final water.AutoBuffer write79(water.AutoBuffer ab, hex.grid.Grid ice) {
write49(ab,ice);
ab.putA((hex.Model.Parameters[])_unsafe.getObject(ice,40L)); // _failed_params
return ab;
}
}
It affects only generics used in array definition.
Workaround is to:
1) create a specific classes - e.g., GBMGrid - GBMGrid extends Grid
or
2) modify code of Grid to use in calls returning arrays the generics upper bound
Example:
class Grid extends Iced {
private MP[] params;
MP[] getParams() {
return params;
}
public addParam(MP param) {
/ .. /
}
}
Then the code: Grid grid = DKV.getGet("myGrid")
for (GBMParameters param : grid.getParams()) {
/ ... /
}
Will throw exception if Grid is fetched from remote node: java.lang.ClassCastException: [Lhex.Model$Parameters; cannot be cast to [Lhex.tree.gbm.GBMModel$GBMParameters;
The problem is that, Icer code does not reflect generics parameters and generates common code for generics' upper bound: class hex.grid.Grid$Icer extends water.Lockable$Icer { protected final water.AutoBuffer write79(water.AutoBuffer ab, hex.grid.Grid ice) { write49(ab,ice); ab.putA((hex.Model.Parameters[])_unsafe.getObject(ice,40L)); // _failed_params return ab; } }
It affects only generics used in array definition.
Workaround is to: 1) create a specific classes - e.g., GBMGrid - GBMGrid extends Grid
or
2) modify code of Grid to use in calls returning arrays the generics upper bound