def calculateError(actual, predict): actual = DataFrameParser.h2oToNumpyArray(actual) predict = DataFrameParser.h2oToNumpyArray(predict) error = 0 for i in range(len(actual)): d = predict[i] - actual[i] if d > 0: error += math.exp(d / 10.0) elif d < 0: error += math.exp(d / 13.0) return error
training_columns = list(pTrain.columns) training_columns.remove('UnitNumber') training_columns.remove('Time') training_columns.remove('RUL') response_column = 'RUL' print("OK") model = H2OGradientBoostingEstimator(distribution='poisson', histogram_type='QuantilesGlobal', fold_assignment='auto') #model = H2ORandomForestEstimator(ntrees=50, max_depth=20, nbins=100, seed=12345) model.train(x=training_columns, y=response_column, training_frame=hTrain, validation_frame=hValidate) print(model.model_performance(test_data=hTest)) predict = DataFrameParser.h2oToNumpyArray(model.predict(test_data=hTest)) actual = DataFrameParser.h2oToNumpyArray(hTest['RUL']) Chart.residual_histogram(actual, predict) Chart.residual_vs_estimated(actual, predict) Chart.acutal_and_predict(actual, predict)