zhangyi-hu / pymcef

Python Monte Carlo Efficient Frontier (PyMCEF) package
BSD 3-Clause "New" or "Revised" License
14 stars 2 forks source link

The kernel appears to have died. It will restart automatically. #9

Closed Amused-Net closed 6 years ago

Amused-Net commented 6 years ago

When I try to run PYMCEF in a down market with no assets exhibiting a positive return, both Jupyter Notebook and QtConsole have the kernel die.

I can provide a dataset and code through PM if you're unable to replicate.

Very, very rarely (maybe 1:20 or 1:50) this error dumps out instead of the kernel breaking:

OverflowError: map size not valid in python

zhangyi-hu commented 6 years ago

I would appreciate your minimum reproducing example.

Thanks

On Fri, Aug 10, 2018, 3:52 PM Amused-Net notifications@github.com wrote:

When I try to run PYMCEF in a down market with no assets exhibiting a positive return, both Jupyter Notebook and QtConsole have the kernel die.

I can provide a dataset and code through PM if you're unable to replicate.

Very, very rarely (maybe 1:20 or 1:50) this error dumps out instead of the kernel breaking:

OverflowError: map size not valid in python

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hzzyyy/pymcef/issues/9, or mute the thread https://github.com/notifications/unsubscribe-auth/AE_ciTZ3wzsJsxbendzXa0N3leYyAD-jks5uPeSOgaJpZM4V4uxA .

Amused-Net commented 6 years ago

I'm having a lot of issues getting it down to a minimum reproducible example. It is erroring out in a number of weird ways. If I cannot reduce it down in the next 45 minutes or so, I'll send you an email with the full data set and full range of code.

The newest thing that's popped up is:


OverflowError Traceback (most recent call last)

in () 4 #for 2016-2017 ----> 5 portfolio_added_data = append_suggested_portfolio(all_pct, 180, 0.0000548) in append_suggested_portfolio(full_data_set, lookback, rfr) 4 appended_data_set = pd.DataFrame() 5 for i in range (210, len(full_data_set)-lookback): ----> 6 next_row = data_efficient_portfolios(data_set = full_data_set, start_date = full_data_set.index[i], end_date = full_data_set.index[i+lookback], rfr = rfr) 7 appended_data_set = appended_data_set.append(next_row) 8 return appended_data_set in data_efficient_portfolios(start_date, end_date, data_set, rfr) 7 frt = pym.SimpleEFp(training_set = np.transpose(training_set.values), 8 validation_set = np.transpose(training_set.values), ----> 9 asset_names = training_set.columns) 10 11 #get the portfolio weights along the efficient frontier ~\Anaconda3\lib\site-packages\pymcef\simple_plot.py in __init__(self, **kwargs) 100 array index will be used as labels. 101 """ --> 102 SimpleEF.__init__(self, **kwargs) 103 104 def _get_axis_label_for_risk(self): ~\Anaconda3\lib\site-packages\pymcef\simple.py in __init__(self, **kwargs) 136 max_sharpe_port_index = self.dic.Max_sharpe_index() 137 max_omega_port_index = self.dic.Max_omega_index() --> 138 max_sharpe_port = _get_portfolio(self.dic.Max_sharpe_portfolio()) 139 max_omega_port = _get_portfolio(self.dic.Max_omega_portfolio()) 140 self.critical_port_in_sample = {} ~\Anaconda3\lib\site-packages\pymcef\simple.py in _get_portfolio(port) 12 def _get_portfolio(port): 13 prt = {} ---> 14 prt['weight'] = port.Weights().asdict() 15 prt['risk'] = port.Risk() 16 prt['reward'] = port.Reward() ~\Anaconda3\lib\site-packages\pymcef\ppslp.py in asdict(self) 223 224 def asdict(self): --> 225 return _ppslp.map_int_double_asdict(self) 226 227 def __init__(self, *args): OverflowError: map size not valid in python
zhangyi-hu commented 6 years ago

OK, this particular exception doesn't seem hard.

On Fri, Aug 10, 2018, 4:52 PM Amused-Net notifications@github.com wrote:

I'm having a lot of issues getting it down to a minimum reproducible example. It is erroring out in a number of weird ways. If I cannot reduce it down in the next 45 minutes or so, I'll send you an email with the full data set and full range of code.

The newest thing that's popped up is:

OverflowError Traceback (most recent call last) in ()

4 #for 2016-2017

----> 5 portfolio_added_data = append_suggested_portfolio(all_pct, 180, 0.0000548)

in append_suggested_portfolio(full_data_set, lookback, rfr) 4 appended_data_set = pd.DataFrame() 5 for i in range (210, len(full_data_set)-lookback): ----> 6 next_row = data_efficient_portfolios(data_set = full_data_set, start_date = full_data_set.index[i], end_date = full_data_set.index[i+lookback], rfr = rfr) 7 appended_data_set = appended_data_set.append(next_row) 8 return appended_data_set

in data_efficient_portfolios(start_date, end_date, data_set, rfr) 7 frt = pym.SimpleEFp(training_set = np.transpose(training_set.values), 8 validation_set = np.transpose(training_set.values), ----> 9 asset_names = training_set.columns) 10 11 #get the portfolio weights along the efficient frontier

~\Anaconda3\lib\site-packages\pymcef\simple_plot.py in init(self, kwargs) 100 array index will be used as labels. 101 """ --> 102 SimpleEF.init(self, kwargs) 103 104 def _get_axis_label_for_risk(self):

~\Anaconda3\lib\site-packages\pymcef\simple.py in init(self, **kwargs) 136 max_sharpe_port_index = self.dic.Max_sharpe_index() 137 max_omega_port_index = self.dic.Max_omega_index() --> 138 max_sharpe_port = _get_portfolio(self.dic.Max_sharpe_portfolio()) 139 max_omega_port = _get_portfolio(self.dic.Max_omega_portfolio()) 140 self.critical_port_in_sample = {}

~\Anaconda3\lib\site-packages\pymcef\simple.py in _get_portfolio(port) 12 def _get_portfolio(port): 13 prt = {} ---> 14 prt['weight'] = port.Weights().asdict() 15 prt['risk'] = port.Risk() 16 prt['reward'] = port.Reward()

~\Anaconda3\lib\site-packages\pymcef\ppslp.py in asdict(self) 223 224 def asdict(self): --> 225 return _ppslp.map_int_double_asdict(self) 226 227 def init(self, *args):

OverflowError: map size not valid in python

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hzzyyy/pymcef/issues/9#issuecomment-412203109, or mute the thread https://github.com/notifications/unsubscribe-auth/AE_ciRLOBXMfh6aO13yIoJ70TSHhdIr9ks5uPfKCgaJpZM4V4uxA .

Amused-Net commented 6 years ago

This issue was solved with an updated package version emailed to me by hzzyy.