# Error running example "Train random forests with uncertainty estimates"

Hi,

I had an issue running the machine learning example “Train random forests with uncertainty estimates”. See the following error.

lolopy installed is version 1.0.1.

Please let me know if you can help.

Thanks,

Zhi-Gang

## Get the Residuals and RF Uncertainty

As described in the Ling paper, ideally-calibrated uncertainty estimaes should have a particular relationship with the errors of a machine learning model. Specifically, the distribution of r(x)/σ(x)r(x)/σ(x) where r(x)r(x) is the residual of the prediction and σ(x)σ(x) is the uncertainty of the prediction for x should have a Gaussian distribution with zero mean and unit standard deviation.

In [25]:

``````
``````
``````model = RandomForestRegressor()
``````
``````
<details class='elided'>
<summary title='Show trimmed content'>&#183;&#183;&#183;</summary>

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-25-93628cc3c8c1> in <module>()
----> 1 model = RandomForestRegressor()

~/anaconda3/lib/python3.6/site-packages/lolopy/learners.py in __init__(self, num_trees, use_jackknife, bias_learner, leaf_learner, subset_strategy, min_leaf_instances, max_depth, uncertainty_calibration, randomize_pivot_location)
273             randomize_pivot_location (bool): whether to draw pivots randomly or always select the midpoint
274         """
--> 275         super(RandomForestMixin, self).__init__()
276
277         # Store the variables

~/anaconda3/lib/python3.6/site-packages/lolopy/learners.py in __init__(self)
31
32     def __init__(self):
---> 33         self.gateway = get_java_gateway()
34
35         # Create a placeholder for the model

~/anaconda3/lib/python3.6/site-packages/lolopy/loloserver.py in get_java_gateway(reuse, skip_devel_version)
72             classpath=os.path.pathsep.join([os.path.abspath(lolo_path)]),
73             javaopts=java_options,
---> 74             redirect_stdout=sys.stdout, die_on_exit=True)
75     return _lolopy_gateway
~/anaconda3/lib/python3.6/site-packages/py4j/java_gateway.py in launch_gateway(cls, port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth)
2111             daemonize_redirect=daemonize_redirect, java_path=java_path,
2112             create_new_process_group=create_new_process_group,
-> 2113             enable_auth=enable_auth)
2114         if enable_auth:
2115             _port, _auth_token = _ret
~/anaconda3/lib/python3.6/site-packages/py4j/java_gateway.py in launch_gateway(port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth)
325     # Determine which port the server started on (needed to support
326     # ephemeral ports)
328
329     # Read the auth token from the server if enabled.

ValueError: invalid literal for int() with base 10: b''
``````

I think this is a problem with Java on your computer. Could you run “java -version” from your command line and let me know the output?

Logan

···

From: Zhigang Mei
Sent: Monday, March 11, 2019 5:03 PM
To: matminer
Subject: Error running example “Train random forests with uncertaintyestimates”

Hi,

I had an issue running the machine learning example “Train random forests with uncertainty estimates”. See the following error.

lolopy installed is version 1.0.1.

Please let me know if you can help.

Thanks,

Zhi-Gang

## Get the Residuals and RF Uncertainty

As described in the Ling paper, ideally-calibrated uncertainty estimaes should have a particular relationship with the errors of a machine learning model. Specifically, the distribution of r(x)/σ(x)r(x)/σ(x) where r(x)r(x) is the residual of the prediction and σ(x)σ(x) is the uncertainty of the prediction for x should have a Gaussian distribution with zero mean and unit standard deviation.

In [25]:

``````model = RandomForestRegressor()

``````

``````ValueError                                Traceback (most recent call last)

``````

in ()

``````----> 1 model = RandomForestRegressor()

``````
``````~/anaconda3/lib/python3.6/site-packages/lolopy/learners.py in __init__(self, num_trees, use_jackknife, bias_learner, leaf_learner, subset_strategy, min_leaf_instances, max_depth, uncertainty_calibration, randomize_pivot_location)

``````

** 273** randomize_pivot_location (bool): whether to draw pivots randomly or always select the midpoint

``````**    274**         """

``````

–> 275 super(RandomForestMixin, self).init()

``````**    276**

``````

** 277** # Store the variables

``````
``````

~/anaconda3/lib/python3.6/site-packages/lolopy/learners.py in init(self)

``````**     31**

``````

** 32** def init(self):

``````---> 33         self.gateway = get_java_gateway()

``````

** 34**

``````**     35**         # Create a placeholder for the model

``````
``````~/anaconda3/lib/python3.6/site-packages/lolopy/loloserver.py in get_java_gateway(reuse, skip_devel_version)

``````

** 72** classpath=os.path.pathsep.join([os.path.abspath(lolo_path)]),

``````**     73**             javaopts=java_options,

``````

—> 74 redirect_stdout=sys.stdout, die_on_exit=True)

** 75** return _lolopy_gateway

``````
``````

~/anaconda3/lib/python3.6/site-packages/py4j/java_gateway.py in launch_gateway(cls, port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth)

``````**   2111**             daemonize_redirect=daemonize_redirect, java_path=java_path,

``````

** 2112** create_new_process_group=create_new_process_group,

``````-> 2113             enable_auth=enable_auth)
``````
``````**   2114**         if enable_auth:

``````

** 2115** _port, _auth_token = _ret

``````
``````

~/anaconda3/lib/python3.6/site-packages/py4j/java_gateway.py in launch_gateway(port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth)

``````**    325**     # Determine which port the server started on (needed to support

``````

** 326** # ephemeral ports)

``````--> 327     _port = int(proc.stdout.readline())

``````

** 328**

``````**    329**     # Read the auth token from the server if enabled.

``````
``````ValueError: invalid literal for int() with base 10: b''

--
You received this message because you are subscribed to the Google Groups "matminer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

</details>``````

You are right. Java runtime environment was not installed initially on my computer. Problem solved after that. Thanks.

···

Best wishes

Zhi-Gang Mei

Great. Thanks for letting me know.

I’ll look into making a more meaningful error message for this issue.

Logan

···

From: Zhi-Gang Mei
Sent: Tuesday, March 12, 2019 9:26 AM
To: Logan Ward
Cc: matminer
Subject: Re: Error running example “Train random forests withuncertaintyestimates”

You are right. Java runtime environment was not installed initially on my computer. Problem solved after that. Thanks.

Best wishes

Zhi-Gang Mei

On Mon, Mar 11, 2019 at 10:45 PM Logan Ward [email protected] wrote:

I think this is a problem with Java on your computer. Could you run “java -version” from your command line and let me know the output?

Logan

From: Zhigang Mei
Sent: Monday, March 11, 2019 5:03 PM
To: matminer
Subject: Error running example “Train random forests with uncertaintyestimates”

Hi,

I had an issue running the machine learning example “Train random forests with uncertainty estimates”. See the following error.

lolopy installed is version 1.0.1.

Please let me know if you can help.

Thanks,

Zhi-Gang

## Get the Residuals and RF Uncertainty

As described in the Ling paper, ideally-calibrated uncertainty estimaes should have a particular relationship with the errors of a machine learning model. Specifically, the distribution of r(x)/σ(x)r(x)/σ(x) where r(x)r(x) is the residual of the prediction and σ(x)σ(x) is the uncertainty of the prediction for x should have a Gaussian distribution with zero mean and unit standard deviation.

In [25]:

``````model = RandomForestRegressor()
``````
``````---------------------------------------------------------------------------
``````
``````ValueError                                Traceback (most recent call last)
``````
``````<ipython-input-25-93628cc3c8c1> in <module>()
``````
``````----> 1 model = RandomForestRegressor()
``````
``````
``````
``````~/anaconda3/lib/python3.6/site-packages/lolopy/learners.py in __init__(self, num_trees, use_jackknife, bias_learner, leaf_learner, subset_strategy, min_leaf_instances, max_depth, uncertainty_calibration, randomize_pivot_location)
``````
``````**    273**             randomize_pivot_location (bool): whether to draw pivots randomly or always select the midpoint
``````
``````**    274**         """
``````
``````--> 275         super(RandomForestMixin, self).__init__()
``````
``````**    276**
``````
``````**    277**         # Store the variables
``````
``````
``````
``````~/anaconda3/lib/python3.6/site-packages/lolopy/learners.py in __init__(self)
``````
``````**     31**
``````
``````**     32**     def __init__(self):
``````
``````---> 33         self.gateway = get_java_gateway()
``````
``````**     34**
``````
``````**     35**         # Create a placeholder for the model
``````
``````
``````
``````~/anaconda3/lib/python3.6/site-packages/lolopy/loloserver.py in get_java_gateway(reuse, skip_devel_version)
``````
``````**     72**             classpath=os.path.pathsep.join([os.path.abspath(lolo_path)]),
``````
``````**     73**             javaopts=java_options,
``````
``````---> 74             redirect_stdout=sys.stdout, die_on_exit=True)
``````
``````**     75**     return _lolopy_gateway
``````
``````
``````
``````~/anaconda3/lib/python3.6/site-packages/py4j/java_gateway.py in launch_gateway(cls, port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth)
``````
``````**   2111**             daemonize_redirect=daemonize_redirect, java_path=java_path,
``````
``````**   2112**             create_new_process_group=create_new_process_group,
``````
``````-> 2113             enable_auth=enable_auth)
``````
``````**   2114**         if enable_auth:
``````
``````**   2115**             _port, _auth_token = _ret
``````
``````
``````
``````~/anaconda3/lib/python3.6/site-packages/py4j/java_gateway.py in launch_gateway(port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth)
``````
``````**    325**     # Determine which port the server started on (needed to support
``````
``````**    326**     # ephemeral ports)
``````
``````--> 327     _port = int(proc.stdout.readline())
``````
``````**    328**
``````
``````**    329**     # Read the auth token from the server if enabled.
``````
``````
``````
``````ValueError: invalid literal for int() with base 10: b''
``````

You received this message because you are subscribed to the Google Groups “matminer” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

Good to know that.

Thanks

Zhi-Gang

···

On Tuesday, March 12, 2019 at 10:38:55 AM UTC-5, Logan Ward wrote:

Great. Thanks for letting me know.

I’ll look into making a more meaningful error message for this issue.

Logan

From: Zhi-Gang Mei
Sent: Tuesday, March 12, 2019 9:26 AM
To: Logan Ward
Cc: matminer
Subject: Re: Error running example “Train random forests withuncertaintyestimates”

You are right. Java runtime environment was not installed initially on my computer. Problem solved after that. Thanks.

Best wishes

Zhi-Gang Mei

On Mon, Mar 11, 2019 at 10:45 PM Logan Ward [email protected] wrote:

I think this is a problem with Java on your computer. Could you run “java -version” from your command line and let me know the output?

Logan

From: Zhigang Mei
Sent: Monday, March 11, 2019 5:03 PM
To: matminer
Subject: Error running example “Train random forests with uncertaintyestimates”

Hi,

I had an issue running the machine learning example “Train random forests with uncertainty estimates”. See the following error.

lolopy installed is version 1.0.1.

Please let me know if you can help.

Thanks,

Zhi-Gang

## Get the Residuals and RF Uncertainty

As described in the Ling paper, ideally-calibrated uncertainty estimaes should have a particular relationship with the errors of a machine learning model. Specifically, the distribution of r(x)/σ(x)r(x)/σ(x) where r(x)r(x) is the residual of the prediction and σ(x)σ(x) is the uncertainty of the prediction for x should have a Gaussian distribution with zero mean and unit standard deviation.

In [25]:

``````model = RandomForestRegressor()
``````
``````---------------------------------------------------------------------------
``````
``````ValueError                                Traceback (most recent call last)
``````
``````<ipython-input-25-93628cc3c8c1> in <module>()
``````
``````----> 1 model = RandomForestRegressor()
``````
``````
``````
``````~/anaconda3/lib/python3.6/site-packages/lolopy/learners.py in __init__(self, num_trees, use_jackknife, bias_learner, leaf_learner, subset_strategy, min_leaf_instances, max_depth, uncertainty_calibration, randomize_pivot_location)
``````
``````**    273**             randomize_pivot_location (bool): whether to draw pivots randomly or always select the midpoint
``````
``````**    274**         """
``````
``````--> 275         super(RandomForestMixin, self).__init__()
``````
``````**    276**
``````
``````**    277**         # Store the variables
``````
``````
``````
``````~/anaconda3/lib/python3.6/site-packages/lolopy/learners.py in __init__(self)
``````
``````**     31**
``````
``````**     32**     def __init__(self):
``````
``````---> 33         self.gateway = get_java_gateway()
``````
``````**     34**
``````
``````**     35**         # Create a placeholder for the model
``````
``````
``````
``````~/anaconda3/lib/python3.6/site-packages/lolopy/loloserver.py in get_java_gateway(reuse, skip_devel_version)
``````
``````**     72**             classpath=os.path.pathsep.join([os.path.abspath(lolo_path)]),
``````
``````**     73**             javaopts=java_options,
``````
``````---> 74             redirect_stdout=sys.stdout, die_on_exit=True)
``````
``````**     75**     return _lolopy_gateway
``````
``````
``````
``````~/anaconda3/lib/python3.6/site-packages/py4j/java_gateway.py in launch_gateway(cls, port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth)
``````
``````**   2111**             daemonize_redirect=daemonize_redirect, java_path=java_path,
``````
``````**   2112**             create_new_process_group=create_new_process_group,
``````
``````-> 2113             enable_auth=enable_auth)
``````
``````**   2114**         if enable_auth:
``````
``````**   2115**             _port, _auth_token = _ret
``````
``````
``````
``````~/anaconda3/lib/python3.6/site-packages/py4j/java_gateway.py in launch_gateway(port, jarpath, classpath, javaopts, die_on_exit, redirect_stdout, redirect_stderr, daemonize_redirect, java_path, create_new_process_group, enable_auth)
``````
``````**    325**     # Determine which port the server started on (needed to support
``````
``````**    326**     # ephemeral ports)
``````
``````--> 327     _port = int(proc.stdout.readline())
``````
``````**    328**
``````
``````**    329**     # Read the auth token from the server if enabled.
``````
``````
``````
``````ValueError: invalid literal for int() with base 10: b''
``````

You received this message because you are subscribed to the Google Groups “matminer” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].