I am trying to predict using wrapcauchy. This was the best fit when running the fit_transform() method.
Unfortunately, I am running into some issues. I keep receiving the error:
'tuple' object has no attribute 'rvs'
thrown on this line:
next_value = dist1.rvs(size=1)
The code:
from scipy.stats import wrapcauchy
# get the historical data up to the second to last value in the sequence
historical_data = dfp["R1"][:-1]
# fit the distribution to the historical data
dist1 = wrapcauchy.fit(historical_data)
# predict the next value
next_value = dist1.rvs(size=1)
# predict the next value
#next_value = dist1.predict([historical_data[-1]])["y"][0]
print("Predicted next value:", next_value[0])
Could someone explain the issue? Thanks
wrapcauchy.fit()
returns a tuple of best fit parameters for a wrapped cauchy random variable - not the random variable itself. Thervs()
method is a method of wrapcauchy, and you pass the results ofwrapcauchy.fit()
as arguments towrapcauchy.rvs()
. $\endgroup$