MXNet initialization error on label variable - deep-learning

When I call module.fit() I'm getting an error
ValueError: Unknown initialization pattern for labelidx.
The symbol "labelidx" is the name I'm using for my label data -- I didn't want to use softmax_label because I'm not using softmax output, but that seems to be the default for a lot of thigns. It seems to be trying to initialize labelidx as a parameter, which is a mistake. How can I tell it this is an input not a learned parameter?

I figured this out.
When constructing the Module object, you need to tell it the names of the data (data_names) and labels (label_names). Each of these should be a list of string names. By default data_names=('data',), label_names=('softmax_label',), Otherwise it assumes everything else is learned parameters and will try to initialize them, leading to this error. Docs: http://mxnet.io/api/python/module.html#mxnet.module.module.Module
So in my case it needs Module(label_names=('labelidx',), ...)

Related

How to use LIKE operator in Slick?

I am trying to use Slick framework for integration with MySQL. However whenever I use LIKE operator it fails with the error, as shown below.
Code
.filterIf(etilizeRequest.q.nonEmpty) {
case ((((((prod, manRep), catRep), cnRep), pdRep), prodSkusRep), saRep) =>
cnRep.map(_.name).like("%"+etilizeRequest.q.get+"%").get
}
Error
slick.SlickException: Caught exception while computing default value
for Rep[Option[_]].getOrElse -- This cannot be done lazily when the
value is needed on the database side at
slick.compiler.HoistClientOps$$anonfun$rewriteDBSide$1.applyOrElse(HoistClientOps.scala:159)
at
slick.compiler.HoistClientOps$$anonfun$rewriteDBSide$1.applyOrElse(HoistClientOps.scala:152)
at slick.ast.NodeOps$.r$1(Util.scala:47) at
slick.ast.NodeOps$.$anonfun$replace$2(Util.scala:48) at
slick.ast.BinaryNode.mapChildren(Node.scala:204) at
slick.ast.BinaryNode.mapChildren$(Node.scala:200) at
slick.ast.Filter.mapChildren(Node.scala:310) at
slick.ast.NodeOps$.g$1(Util.scala:48) at
slick.ast.NodeOps$.r$1(Util.scala:47) at
slick.ast.NodeOps$.$anonfun$replace$2(Util.scala:48) Caused by:
slick.SlickException: Read NULL value for column
slick.lifted.OptionColumnExtensionMethods#594b5a63 at
slick.lifted.OptionColumnExtensionMethods$.$anonfun$get$1(ExtensionMethods.scala:39)
at
slick.compiler.HoistClientOps$$anonfun$rewriteDBSide$1.applyOrElse(HoistClientOps.scala:156)
at
slick.compiler.HoistClientOps$$anonfun$rewriteDBSide$1.applyOrElse(HoistClientOps.scala:152)
at slick.ast.NodeOps$.r$1(Util.scala:47) at
slick.ast.NodeOps$.$anonfun$replace$2(Util.scala:48) at
slick.ast.BinaryNode.mapChildren(Node.scala:204) at
slick.ast.BinaryNode.mapChildren$(Node.scala:200) at
slick.ast.Filter.mapChildren(Node.scala:310) at
slick.ast.NodeOps$.g$1(Util.scala:48) at
slick.ast.NodeOps$.r$1(Util.scala:47)
Can someonw suggest the reasoning behind this error and how can I fix it ?
Slick can't always call .get on an Option when the .get happens at the SQL level. It's not clear to me when this happens, but in your example I'd guess it will be the final .get at the end. I think that because we'd be asking, at the database level, to turn an optional like expression into SQL. I don't think that's possible.
In your case there's a work around to convert an optional column to a string column:
cnRep.map(_.name).asColumnOf[String].like(...etc...)
...and you can omit the final .get call. (I actually thought automatic support for this was added in Slick 3.3, but I guess not).
You may also be able to use filterOpt rather than filterIf. That would remove one more get from inside your LIKE expression. Section 2.9 of Essential Slick gives some examples.

'Unable to invoke CFC - The data for must be no more than 100 characters in length

I'm trying to call a method as follows:
<cfinvoke component="#variables.target#"
method="#arguments.methodName#"
argumentcollection="#arguments.args#"
returnvariable="rtn">
</cfinvoke>
However, I am getting the following error:
Unable to invoke CFC - The data for 'param_value' must be no more than
100 characters in length.' faultDetail:''
The variable arguments.args is a struct and one of its elements looks like this:
{
param_name: 'property_uid',
param_value : '00000000-0000-0000-0000-0000000213131200,00002131300-0000-0000-0000-000000000000,00000000-0000-0000-0000-0000000002122,00000000-0000-0000-0000-000000032242
}
I know the problem is caused by this element, but don't know how to fix it.
Note that I've already updated the Maximum number of POST request parameters from 100 to 300 in the CF Administrator.
The variable property_uid is currently a list and the list's value is too long to be passed in as a struct key's value. Use listToArray() to send the data as an array. Inside the function, convert it back using arrayToList() if you need the data as a list again.
Please check the code of the invoked function (the function name can be found in your variable arguments.methodName in the component of variables.target).
Look for the tag <cfparam name="param_value" ...> and check if there is a maxlength attribute defined. It's probably set to 100 and thus causes ColdFusion to throw an exception if you pass more than 100 characters to said parameter.
Having a limit of 100 characters is probably a design descision on your side (database scheme?), so you need to figure this out by yourself.

multiple parameters from variables in Process Task Editor

This is driving me potty.
I'm trying to pass two SSIS variables to a command line executable using an Execute Process Task object.
No matter what I try, the values are not being passed through.
This is how it is set currently:
The variables are in scope and are of type string (representing integer values).
Sods law came into effect after posting this question. I tried evaluating my variables as an expression and assigning the resulting string to the arguments property.
I don't see why this would work over the example I gave, but it does, so I'm using that.

Fluent bind not working as expected

Suppose I am binding using
bs.Bind(y)
.For(v => v.Visibility)
.To("Failures['TaxPercent'].Length")
.WithConversion("Visibility")
.WithFallback(false);
Where Failures is a dictionary which would contain the property name (e.g. TaxPercent) if, and only if, the property fails validation.
Therefore Failure['TaxPercent'] returns the validation failure message (e.g value missing).
I want to have an expandable textview in Android which is visible only when the error is detected. I used the above code and it is not working. The fallback value does not trigger when Failure['TaxPercent'] does not exist in the dictionary.
How do I get an expandable/collapsible textview based on the validation result using a dictionary in the viewmodel??? I would really like to use a dictionary because that would save me from creating IsErrorVisible for each property.
Oddly enough, using a dictionary works for retrieving the error message though, but not for visibility! In other words, this is working great
bs.Bind(y)
.For(v => v.Text)
.To("Failures['TaxPercent']");
Also, any reason why I cannot concatenate the binding, meaning can I do this???
bs.Bind(y)
.For(v => v.Text)
.To("Failures['TaxPercent']")
.For(v => v.Visibility)
.To("Failures['TaxPercent'].Length")
.WithConversion("Visibility")
.WithFallback(false);
EDIT
The error msg in the log is
MvxBind:Error:168.86 Problem seen during binding execution for binding Visibility for Failures['TaxPercent'].Length - problem ArgumentException: The value passed in must be an enum base or an underlying type for an enum, such as an Int32.
If the dictionary doesn't contain an entry for 'TaxPercent' then the expression Failures['TaxPercent'].Length will not evaluate (an exception will be throw) so UnsetValue will be used.
In the case of UnsetValue, the ValueConverter will not be called, and the Fallback will be used. This is the same pattern as in Wpf - http://msdn.microsoft.com/en-us/library/system.windows.dependencyproperty.unsetvalue(v=vs.110).aspx
For your particular situation, it looks like you could either:
change the Fallback to the correct value for the platform instead of to a boolean value (the question didn't specify which platform(s) you are using)
create a new Visibility ValueConverter that takes Failures as its binding source and 'TaxPercent' as its parameter
remove the .Length from your binding expression - just test on the existence of the entry.
you could switch to free text binding expressions - then you could do more complicated binding statements, including nested bindings, multiple value converters, multiple fallback values, ...
For this particular case, I would just drop the .Length
For "any reason why I cannot concatenate", that won't work as the return type of Bind is a single Fluent binding entry - not a Fluent binding set.

Why do I get a "Too many input arguments" error when not passing any?

I am working on some simple object-oriented code in MATLAB. I am trying to call one of my class methods with no input or output arguments in its definition.
Function definition:
function roll_dice
Function call:
obj.roll_dice;
When this is executed, MATLAB says:
??? Error using ==> roll_dice
Too many input arguments.
Error in ==> DiceSet>Diceset.Diceset at 11
obj.roll_dice;
(etc...)
Anyone have any ideas what could be causing it? Are there secret automatic arguments I'm unaware that I'm passing?
When you make the call:
obj.roll_dice;
It is actually equivalent to:
roll_dice(obj);
So obj is the "secret" automatic argument being passed to roll_dice. If you rewrite the method roll_dice to accept a single input argument (even if you don't use it), things should work correctly.
Alternatively, if you know for sure that your method roll_dice is not going to perform any operations on the class object, you can declare it to be a static method as Dan suggests.
For more information on object-oriented programming in MATLAB, here's a link to the online documentation.
I believe you can also get around this by declaring roll_dice to be a static method.