When going through the exponential smoothing tutorial provided by statsmodels, I had an issue with specifying an initialization method in anaconda notebook. The error would return:
TypeError: init() got an unexpected keyword argument 'initialization_method'
It would reference the first line in the cell:
fit1 = Holt(air, initialization_method="estimated").fit(smoothing_level=0.8, smoothing_trend=0.2, optimized=False)
When looking for the solution, I downgraded my prompt-toolkit but that didn't do anything. I can't find anyone else having this problem, any ideas?
Related
Pardon me for being lazy about this, but I'm not getting the answer anywhere.
I'm trying to replicate the exercise here in my own computer: https://github.com/tensorflow/probability/blob/main/tensorflow_probability/examples/jupyter_notebooks/Structural_Time_Series_Modeling_Case_Studies_Atmospheric_CO2_and_Electricity_Demand.ipynb
However, I'm getting stuck at this part:
# Build and optimize the variational loss function.
elbo_loss_curve = tfp.vi.fit_surrogate_posterior(
target_log_prob_fn=co2_model.joint_distribution(
observed_time_series=co2_by_month_training_data).log_prob,
surrogate_posterior=variational_posteriors,
optimizer=tf.optimizers.Adam(learning_rate=0.1),
num_steps=num_variational_steps,
jit_compile=True)
plt.plot(elbo_loss_curve)
plt.show()
I get:
TypeError: TF_TryEvaluateConstant_wrapper(): incompatible function arguments. The following argument types are supported:
1. (arg0: tensorflow.python.client._pywrap_tf_session.TF_Graph, arg1: tensorflow.python.client._pywrap_tf_session.TF_Output) -> object
Invoked with: <tensorflow.python.framework.c_api_util.ScopedTFGraph object at 0x0000024EDCF90C70>, <tensorflow.python.client._pywrap_tf_session.TF_Output object at 0x0000024EDD26DBB0>
Anyone knows what the cause is? I get that there's a problem with my input but i'm looking for a fix.
so I started reading deep learning with pytorch, and got to the point of setting names to the dimensions inside the tensor, to make it more friendly, but as soon as I use the names argument, I get the error:
TypeError: tensor() got an unexpected keyword argument 'names'
can anyone help me out?
The code is simple:
import torch
weights_named = torch.tensor([0.2126, 0.7152, 0.0722], names=['channels'])
weights_named
Just want to run this, to see how to set names to the dimensions. Thanks in advance.
This is due to your PyTorch Version. Upgrade your Pytorch version and should work. In my case,
import torch
torch.__version__ #1.7
weights_named = torch.tensor([0.2126, 0.7152, 0.0722], names=['channels'])
# __main__:1: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change.
Named tensors and functions supporting it on latest 1.9 release, but on 1.7 (my version) is still experimental.
It's my first time working with scipy.signal library and I am experimenting an error with the method filtfilt().
This is the code I am trying to execute:
Fs = 1000
# s is an array of numbers
a=signal.firwin(10, cutoff=0.5/(Fs/2))
ss = s - np.mean(s)
se = signal.filtfilt(a, 1, ss, method="gust")
When I execute this code I get the next error:
TypeError: filtfilt() got an unexpected keyword argument 'method'
But in the documentation of the method it is clearly shown that the parameter 'method' exists.
What could be the problem?
I would guess you have different versions of scipy in use. The documentation of filtfilt says the 'gust' method was added in 0.16. I assume the method parameter does not exist in earlier versions.
When was the filter_flip parameter for theano.tensor.nnet.conv2d() introduced in Theano? (i.e., which is the minimum Theano version that supports it?)
My version (0.7.0.dev-8d3a67b73fda49350d9944c9a24fc9660131861c) doesn't have it:
File "/usr/local/lib/python2.7/dist-packages/theano/tensor/nnet/conv.py", line 146, in conv2d
imshp=imshp, kshp=kshp, nkern=nkern, bsize=bsize, **kargs)
TypeError: __init__() got an unexpected keyword argument 'filter_flip'
Theano's change log doesn't mention filter_flip. The documentation for theano.tensor.nnet.conv2d() doesn't mention the minimum required version.
It appears in version 0.8.0.
Note that in that release the implementation of theano.tensor.nnet.conv2d() found in theano/tensor/nnet/conv.py becomes deprecated and is replaced by the new implementation placed into theano/tensor/nnet/__init__.py and theano/tensor/nnet/abstract_conv.py.
I'm using scikit-learn (0.14) and trying to implement a user defined metric for my KernelDensity estimation.
Following code is an example how my code is structured:
def myDistance(x,y):
return np.sqrt(sum((x - y)**2))
dt=DistanceMetric.get_metric("pyfunc",func=myDistance)
kernelModel=KernelDensity(algorithm='ball_tree',metric='pyfunc')
kernelModel.fit(X)
According to the documentation, the BallTree algorithm should accept user defined metrics.
If I run this code the way given here, I get following error:
TypeError: __init__() takes exactly 1 positional argument (0 given)
The error seems to come from:
sklearn.neighbors.dist_metrics.PyFuncDistance.__init__
I don't understand this. If i check what 'dt' in the code above gives me, I get what I expect. dt.pairwise(X) returns the correct values.
What am I doing wrong?
Thanks in advance.
Solution is
kernelModel=KernelDensity(...,metric='pyfunc',metric_params={"func":myDistance})
The call to Distancemetric.get_metric is not necessary.
M