Azure ML Error: TimeSeriesImputer object has no attribute '_known_df' - time-series

Running this orange juice sales notebook I get the below error with the .forecast() method.
code
# The featurized data, aligned to y, will also be returned.
# This contains the assumptions that were made in the forecast
# and helps align the forecast to the original data
y_predictions, X_trans = fitted_model.forecast(X_test)
Error (full stacktrace):
**AttributeError: 'TimeSeriesImputer' object has no attribute '_known_df'**

This is commonly fixed by upgrading to the latest SDK. You can do this by running pip install --upgrade azureml-sdk[explain,automl].
Thanks,
Sabina

Related

How can I see every change a pip install makes?

I'm working on an air-gapped PC and I'd like to install xgboost so I can use it in a machine learning model. However, to do so I have to move xgboost over on a thumbdrive.
I've tried downloading it to a similar machine and transferring it over, but it seems like the python _ctypes don't get moved over, and I get the following error when I try and use XGBoost:
CDLL.__getitem__(self, name_or_ordinal)
400 def __getitem__(self, name_or_ordinal):
--> 401 func = self._FuncPtr((name_or_ordinal, self))
402 if not isinstance(name_or_ordinal, int):
403 func.__name__ = name_or_ordinal
AttributeError: function 'XGBGetLastError' not found
I don't understand Python's C based backend, so I'm not sure how to fix this without knowing exactly what changes pip made when installing xgboost.
Is there a way to see all the changes pip makes when installing a package?

Getting InvalidGeometry: LinearRing failed ring test after upgrading rgeo gem

After upgrading the rgeo gem from 0.6.0 to 2.1.1, we've started to get 'LinearRing failed ring test' on certain geometries that never caused us problems before. (The geometry data is generated from external sources outside of our control, and stored in PostGIS table.)
rgeo initializer:
GEO_FACTORY = RGeo::Geographic.simple_mercator_factory
PROJECTION_FACTORY = GEO_FACTORY.projection_factory
RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config|
config.default = PROJECTION_FACTORY
end
Example code:
district = District.first
# Convert projected geometry to geographic geometry
geographic_geometry = GEO_FACTORY.unproject(district.geometry)
RGeo::Error::InvalidGeometry: LinearRing failed ring test
I also tried initializing the factory with the following options, but the errors persisted:
FACTORY = RGeo::Geographic.simple_mercator_factory(uses_lenient_assertions:true)
FACTORY = RGeo::Geographic.simple_mercator_factory(lenient_multi_polygon_assertions:true)
I've inspected some of these geometries where that are failing the LinearRing test, and it appears they are failing for a variety of reasons. Some possibly violate ring winding order, while with others I couldn't perceive the exact problem. But the point is, these are all geometries that we were able to work with before, and now are raising errors. I'd like to understand how we can return to the more lenient mode.
NOTES:
This is only happening on my Macbook (GEOS version 3.8.0), but not on our Linux production server (GEOS version 3.5.0)
REFERENCES:
https://github.com/rgeo/rgeo/issues/194
https://github.com/rgeo/rgeo-geojson/issues/33
This doesn't appear to be an issue with the rgeo gem but rather the underlying geos library on your mac.
There appears to be a difference in the way that geos 3.8.x (3.8.1 is the latest version in Homebrew circa 4/13/2020) and earlier versions of the geos library handle the is_simple calculation that determines Polygon validity. This affects any RGeo factory (most of them but not RGeo::Geographic.spherical_factory or RGeo::Cartesian.simple_factory) backed by the CAPI.
If you download version 3.5.x of geos from https://trac.osgeo.org/geos/ and build it with cmake (takes a while but installs cleanly) you should have consistent behavior between your production and local development environments.
If you were using the simple_mercator factory I doubt that differences in how spherical coordinates (implemented in pure ruby) are validated explain the differences in behavior that you see.
See this issue: https://github.com/rgeo/rgeo/issues/218
You most probably encountered this [1] bug. Reproducing needs Mac OS and shows the error you have:
RGeo::Error::InvalidGeometry (LinearRing failed ring test)
Issue is linked to pull request [2], which found the issue on Float vs BigDecimal difference. Somehow Floats are not so precise, when there are enough decimals included.
Side note: Pull request is only 26 days old, so it is still open, thus you'll need to build it from branch for the moment.
Source:
[1] https://github.com/rgeo/rgeo/issues/212
[2] https://github.com/rgeo/rgeo/pull/213

Why does xLearn fit function causes kernel crashes in Jupyter?

I'm trying to make CTR (Click through rate) prediction using a python module named 'xlearn'.
It enables me to implement a FFM (field-aware factorisation machine) quite easily.
However, I have a problem with the fit function ( supposed to train the model) which crashes the kernel of my jupyter notebook without any error messages.
Here is the code :
import xlearn as xl
ffm_model = xl.create_ffm()
param = {'task':'binary', 'lr':0.2, 'lambda':0.002, 'metric':'acc'}
ffm_model.setTrain('ffm_train.txt')
ffm_model.fit(param, "./model.out") #this line crashes the kernel
I've already tried to fit the model just after python ffm_model = xl.create_ffm() this also crashes the kernel without any error messages ...
Don't hesitate to share your ideas I'm really stuck here.
I didn't realize the xLearn module was showing error messages in the terminal :
Xlearn Imgae Error Messages

Using TensorFlow Audio Recognition Model on iOS

I'm trying to use the TensorFlow audio recognition model (my_frozen_graph.pb, generated here: https://www.tensorflow.org/tutorials/audio_recognition) on iOS.
But the iOS code NSString* network_path = FilePathForResourceName(#"my_frozen_graph", #"pb"); in the TensorFlow Mobile's tf_simple_example project outputs this error message: Could not create TensorFlow Graph: Not found: Op type not registered 'DecodeWav'.
Anyone knows how I can fix this? Thanks!
I believe you are using the pre-build Tensorflow from Cocapods? It probably does not have that op type, so you should build it yourself from latest source.
From documentation:
While Cocapods is the quickest and easiest way of getting started, you
sometimes need more flexibility to determine which parts of TensorFlow
your app should be shipped with. For such cases, you can build the iOS
libraries from the sources. This guide contains detailed instructions
on how to do that.
This might also be helpful: [iOS] Add optional Selective Registration of Ops #14421
Optimization
The build_all_ios.sh script can take optional
command-line arguments to selectively register only for the operators
used in your graph.
tensorflow/contrib/makefile/build_all_ios.sh -a arm64 -g $HOME/graphs/inception/tensorflow_inception_graph.pb
Please note this
is an aggresive optimization of the operators and the resulting
library may not work with other graphs but will reduce the size of the
final library.
After the build is done you can check /tensorflow/tensorflow/core/framework/ops_to_register.h for operations that were registered. (autogenerated during build with -g flag)
Some progress: having realized the unregistered DecodeWav error is similar to the old familiar DecodeJpeg issue (#2883), I ran strip_unused on the pb as follows:
bazel-bin/tensorflow/python/tools/strip_unused \
--input_graph=/tf_files/speech_commands_graph.pb \
--output_graph=/tf_files/stripped_speech_commands_graph.pb \
--input_node_names=wav_data,decoded_sample_data \
--output_node_names=labels_softmax \
--input_binary=true
It does get rid of the DecodeWav op in the resulting graph. But running the new stripped graph on iOS now gives me an Op type not registered 'AudioSpectrogram' error.
Also there's no object file audio*.o generated after build_all_ios.sh is done, although AudioSpectrogramOp is specified in tensorflow/core/framework/ops_to_register.h:
Jeffs-MacBook-Pro:tensorflow-1.4.0 zero2one$ find . -name decode*.o
./tensorflow/contrib/makefile/gen/obj/ios_ARM64/tensorflow/core/kernels/decode_bmp_op.o
./tensorflow/contrib/makefile/gen/obj/ios_ARM64/tensorflow/core/kernels/decode_wav_op.o
./tensorflow/contrib/makefile/gen/obj/ios_ARMV7/tensorflow/core/kernels/decode_bmp_op.o
./tensorflow/contrib/makefile/gen/obj/ios_ARMV7/tensorflow/core/kernels/decode_wav_op.o
./tensorflow/contrib/makefile/gen/obj/ios_ARMV7S/tensorflow/core/kernels/decode_bmp_op.o
./tensorflow/contrib/makefile/gen/obj/ios_ARMV7S/tensorflow/core/kernels/decode_wav_op.o
./tensorflow/contrib/makefile/gen/obj/ios_I386/tensorflow/core/kernels/decode_bmp_op.o
./tensorflow/contrib/makefile/gen/obj/ios_I386/tensorflow/core/kernels/decode_wav_op.o
./tensorflow/contrib/makefile/gen/obj/ios_X86_64/tensorflow/core/kernels/decode_bmp_op.o
./tensorflow/contrib/makefile/gen/obj/ios_X86_64/tensorflow/core/kernels/decode_wav_op.o
Jeffs-MacBook-Pro:tensorflow-1.4.0 zero2one$ find . -name audio*_op.o
Jeffs-MacBook-Pro:tensorflow-1.4.0 zero2one$
Just verified that Pete's fix (https://github.com/tensorflow/tensorflow/issues/15921) is good:
add this line tensorflow/core/ops/audio_ops.cc to the file tensorflow/contrib/makefile/tf_op_files.txt and run tensorflow/contrib/makefile/build_all_ios.sh again (compile_ios_tensorflow.sh "-O3" itself used to work for me after adding a line to the tf_op_files.txt, but not anymore with TF 1.4).
Also, use the original model file, don't use the stripped version. Some note was added in the link above.

how can i upgrade my caffe model so it doesn't 'upgrade' every time I use it

I am using caffe with python(pycaffe). I am using the prebuilt alexnet model from model zoo.
from this page:
https://github.com/BVLC/caffe/tree/master/models/bvlc_alexnet
Every time I use the model, with this code:
net = caffe.Classifier('deploy.prototxt','bvlc_alexnet.caffemodel',
channel_swap=(2,1,0),
raw_scale=255,
image_dims=(256, 256))
caffe tells me the file format is old and it needs to upgrade the file. Shouldn't this happen only once?
E0304 20:52:57.356480 12716 upgrade_proto.cpp:609] Attempting to upgrade input file specified using deprecated transformation parameters: /tmp/bvlc_alexnet.caffemodel
I0304 20:52:57.356554 12716 upgrade_proto.cpp:612] Successfully upgraded file specified using deprecated data transformation parameters. E0304 20:52:57.356564 12716 upgrade_proto.cpp:614] Note that future Caffe releases will only support transform_param messages for transformation fields.
E0304 20:52:57.356580 12716 upgrade_proto.cpp:618] Attempting to upgrade input file specified using deprecated V1LayerParameter: /tmp/bvlc_alexnet.caffemodel
I0304 20:52:59.307096 12716 upgrade_proto.cpp:626] Successfully upgraded file specified using deprecated V1LayerParameter
how can I properly upgrade the file so that this doesn't happen every single time.
When you load the model caffe upgrades your prototxt and binary proto, but does not override the original files you are using. This is why you keep getting this message.
Upgrading is very straight forward. In $CAFFE_ROOT/build/tools you'll find two binaries: upgrade_net_proto_binary and upgrade_net_proto_text. Simply apply them to your deploy.prototxt and bvlc_alexnet.caffemodel and save the results:
~$ mv deploy.prototxt deploy_old.prototxt
~$ mv bvlc_alexnet.caffemodel bvlc_alexnet_old.caffemodel
~$ $CAFFE_ROOT/build/tools/upgrade_net_proto_text deploy_old.prototx deploy.prototxt
~$ $CAFFE_ROOT/build/tools/upgrade_net_proto_binary bvlc_alexnet_old.caffemodel bvlc_alexnet.caffemodel
And that's it!
Thank you for Shai for your help.
However, if you are in Windows upgrade_net_proto_binary and upgrade_net_proto_text .exe files are in path-to-caffe-master/caffe/build/tools/Release.
Hope this will help Windows users

Resources