Scikit-Survival выдает AttributeError: объект float не имеет атрибута exp при вызове numpy.exp
Я получаю следующее сообщение об ошибке:
AttributeError: 'float' object has no attribute 'exp'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/herman/Documents/epistats/hw/hw4/hw4p2.py", line 125, in <module>
chf_funcs = model.predict_cumulative_hazard_function(exposure3[:5])
File "/opt/anaconda3/lib/python3.8/site-packages/sksurv/linear_model/coxph.py", line 527, in predict_cumulative_hazard_function
return self._baseline_model.get_cumulative_hazard_function(self.predict(X))
File "/opt/anaconda3/lib/python3.8/site-packages/sksurv/linear_model/coxph.py", line 97, in get_cumulative_hazard_function
risk_score = numpy.exp(linear_predictor)
TypeError: loop of ufunc does not support argument 0 of type float which has no callable exp method
Означает ли это, что в какой-то момент переменная
numpy
установлен на поплавок?
Вот мой код:
exposure3 = data[['Height0', 'Weight0', 'Sbp0', 'Chol0', 'Dibpat0']]
validValues = np.argwhere(data['Chol0'].to_numpy() != '.')[:,0]
exposure3 = exposure3.iloc[validValues]
data_y3 = data_y[validValues]
dtypes = {'Height0': 'int64',
'Weight0': 'int64',
'Sbp0': 'int64',
'Chol0': 'int64',
'Dibpat0': 'category'}
exposure3 = exposure3.astype(dtypes)
model = CoxPHSurvivalAnalysis().fit(exposure3, data_y3)
chf_funcs = model.predict_cumulative_hazard_function(exposure3[:5])
# error