BigDL : Saving a model throws Exception: "This is a deprecated method. Please use saveModel instead." - bigdl

I am using BigDL + Analytics-Zoo for doing Anomaly detection on time-series data.
When I try to save the model using the .save() method after training,
I am getting the Exception: "This is a deprecated method. Please use saveModel instead."
Generally, deprecations come as a warning, but here it is thrown as an Exception, so I am wondering is this real reason for the Exception? or is there some other reason behind this?
If I call 'saveModel' method, it works, but my question is why should the API still keeping a .save() method if it is not supported?
model.save(model_path, over_write=True)
.
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-135-b922e545922f> in <module>()
----> 1 model.save(model_path, over_write=True)
/usr/local/lib/python3.6/dist-packages/zoo/pipeline/api/keras/engine/topology.py in save(self, path, over_write)
31 class KerasNet(ZooKerasLayer):
32 def save(self, path, over_write=False):
---> 33 raise Exception("This is a deprecated method. Please use saveModel instead.")
34
35 def saveModel(self, modelPath, weightPath=None, over_write=False):
Exception: This is a deprecated method. Please use saveModel instead.

it is legacy issue, please use saveModel instead.

Related

The function has return type of 'FutureOr<User>', but doesn't end with a return statement

I am trying to create a repository for use cases of FirebaseAuth and can see warnings!
Should I ignore the warning, as it not impacting the app?
OR should I handle it now, and How?
Dart has analyzed your program and found out that you have not handled all cases how the method can exit. This is a potentially a problem since your method signature specifies that you method are returning a Future<User> object.
In your case you have not handled the case where an exception are throw from the createUserWithEmailAndPassword method. If an exception are catch, you ends up with a execution path without any return statement.
In this case, Dart will at runtime just return null so it is not an error. But it is a potential sign of a code error since it it not unlikely that you have forgotten the handling of the exception by not have any return statement.
If it is your intention to just return null in case of an exception, you should therefore have insert return null; in both of your catch blocks (or just at the bottom of your method outside the catch-blocks).
Alternative, you can rethrow the exception if you just want to add some logging but still let the caller to also handle the exception. You can read more about this in the language tour: https://dart.dev/guides/language/language-tour#catch
In either cases, you should describe the behavior in the documentation of the method.

Kryo serialization refuses to register class

I'm trying to use kryo serialization with:
kryo.setRegistrationRequired(true);
I keep getting the following error saying that a certain class is not registered:
java.lang.IllegalArgumentException: Class is not registered: com.my.package.MyClass[]
Note: To register this class use: kryo.register(com.my.package.MyClass[].class);
However, I do register it:
kryo.register(classOf[MyClass[_]])
When I set Log.TRACE() I get the following output:
00:11 TRACE: [kryo] Register class ID 51: com.my.package.MyClass (com.esotericsoftware.kryo.serializers.FieldSerializer)
Why does it say it is not registered, when the trace logger prints that it has been registered. I cannot find any useful documentation on the matter. Has anyone experienced this before? If it helps i'm running Apache Spark v0.8.1
I figured out what the issue was. I was mistaking the java array syntax [] for the scala generic syntax []. The exception was being being thrown since I did not register an array of MyClass.
So in java
kryo.register( MyClass[].class );
And scala
kryo.register( classOf[ Array[ MyClass[_] ] ] )

Can't locate object method "find_md5" via package "DBM::Deep::Engine::Sector::Scalar"

Does any one know why am getting this error ?
Can't locate object method "find_md5" via package "DBM::Deep::Engine::Sector::Scalar" at /u/xref/xref.10/bin/../lib/perl5/site_perl/5.8.8/DBM/Deep/Engine.pm line 1599
Please let me know how to get Rid of this.
Because $o->find_md5 was called where $o is the string DBM::Deep::Engine::Sector::Scalar or an object of class DBM::Deep::Engine::Sector::Scalar, yet that class doesn't have a method named find_md5.
(DBM::Deep::Engine::Sector::Scalar doesn't even seem to exist in newer version of the DBM::Deep distribution, so upgrading DBM::Deep would be a good start.)

Introspecting maximum column length using IronPython and EDM

I am engaged in an ETL project using IronPython and loading into a SQL Server database represented by an EDM 4.1 model provided to me. While I can generally load and save the data without trouble, I'm plagued by string length overruns in the incoming data. This throws an exception in the final .SaveChanges() call to the EDM. I receive no information in the exception about what entity, entity class, or property threw the error.
I would like to modify my code so that it checks the max length of the column for the database's metadata at the time of assignment. It appears that this metadata is not available through the entity class but rather using the MetadataWorkspace of the EDM context object.
In order to call .GetItems() on the MetadataWorkspace, I need to provide an enumeration value from System.Data.Metadata.Edm.Dataspace:
.GetItems(System.Data.Metadata.Edm.Dataspace.CSpace)
Unfortunately, I don't seem to be able to reference System.Data.Metadata in any way. I cannot get beyond System.Data:
>>> import clr
>>> clr.AddReference("System.Data")
>>> import System.Data
>>> clr.AddReference("System.Data.Metadata")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: System.IO.IOException: Could not add reference to assembly System.Data.Metadata
at IronPython.Runtime.ClrModule.AddReference(CodeContext context, String name)
Does anyone have experience in introspecting EDM metadata from IronPython?
To be able to access MetadataWorkspace you need to add reference to System.Data.Entity.dll (if you don't have one) and then drop down to ObjectContext like this:
((IObjectContextAdapter)ctx).ObjectContext.MetadataWorkspace
where ctx is your DbContext derived class.
Also in EF 4.1 there is a Validation feature implemented. I am not sure if this what throws the exception because it should give you all the details - including property name and a reference to the entity where the validation error occured. If the exception is thrown by the database it would mean that Validation is turned off. If you turned it on it would check facets and throw an execption if they are validated. Here are the links to blog posts on Validation:
http://blogs.msdn.com/b/adonet/archive/2011/05/27/ef-4-1-validation.aspx
http://blogs.msdn.com/b/adonet/archive/2010/12/15/ef-feature-ctp5-validation.aspx

How to do exception handling with nunit and moq?

I am trying to use nunits new way of exception handling but I am finding it hard to find information on it and how to also use it with moq.
I have right now moq that throws a exception on a mocked method but I don't know how to use nunit to catch it and look at it.
There's a few different ways to do it; I use Assert.Throws.
var exception = Assert.Throws<YourTypeOfException>(()=> Action goes here);
e.g.
var exception = Assert
.Throws<ArgumentNullException>(()=> new ChimpPuncher(null));
You can then query the exception object further if you want, e.g.
Assert.That(exception.Message, Text.Contains("paramname");
Best way to mention is: [ExpectedException(typeof(ApplicationException))] above the test method.
Why can't you enclose the mocked method call in a try/catch block and catch the specific exception being thrown?