Call an Embedded Function from Python
You must use the oml.do_eval
function to run a
user-defined Python function.
The following example calls the errorModelPredict
function, passing the test data without the target variable.
spatial_error_predictions = oml.do_eval(func='errorModelPredict', X=X_test.drop("MEDIAN_INCOME"))
print(spatial_error_predictions[:10])
The code prints the first ten predictions for the test data.
[[85565.81571662657], [88769.98209276547], [46010.46116330226], [61275.919165868865], [163674.5321011373], [40178.55663104116], [89290.25850064949], [47908.54834079923], [83884.02318889851], [50495.29040429841]]