How to solve ‘error in derived variable in SPSS'? - spss

enter image description here
When I do 'overlay scatter plot', I face an error "Error in derived variable Variable13' defined as:constant(variable x variable y)。

Related

OpenCv error while running the setMouseCallback

I am trying to run the cv.setMouseCallback and getting the above error. I am trying to apply the water algorithm on the image.
I am looking to how could i resolve the mentioned error.
error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window_w32.cpp:2563: error: (-27:Null pointer) NULL window: 'image' in function 'cvSetMouseCallback'

I'm trying to plot the confusion matrix for the predictions on my test set using my neural network model, but this error keeps on popping out

I'm trying to plot the confusion matrix for the predictions on my test set using my neural network model, but this error keeps on popping out. Can you please help me out. I tried to clicked the search on stackoverflow, but I didn't get a definitive answer. Can someone please help me out to resolve this error and pinpoint what error I have made? Also, if possible, what suggestions can you give? Thank you so much. Here is the picture of my code and this is my actual work
This is the code:
cm_plot_labels=['adobong baboy', 'arroz caldo','bagnet','balut','bicol express','biko' ,'binignit','bulalo','caldereta','camaro rebusado','champorado',
'chicharon','chicken inasal','cooked white rice','fish kinilaw','halo halo','liempo','maja blanca','pancit habhab', 'pandesal', 'pastillas de leche','pichi pichi',
'puto bumbong','puto rice cake','rellenong alimango','sinugno','sisig','suman','tapa','tinola','tuna panga','turon','ube halaya' ]
plot_confusion_matrix(cm=cm, classes=cm_plot_labels, title='Confusion Matrix')
As the error states, 'plt.cm.Blues' is not a valid value for the cmap argument of the plt.imshow function. The error suggests possible valid values that can be passed as the cmap value.
So, to solve your error you should be able to just set the default value of cmap in the plot_confusion_matrix function parameters to the string value 'Blues' instead of 'plt.cm.Blues'.
Here is the documentation for the plt.imshow function which you are using. Here it gives details of what the parameters are (including cmap) and what valid values can be passed to them.
https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imshow.html

Combining WareHouseModel and Experiments

I am trying to run experiments using the WarehouseRenderer and AgvRenderer from AgvExample.
I get the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve dependency for implementations of interface com.github.rinde.rinsim.core.model.road.CollisionGraphRoadModel, as requested by WarehouseRenderer.builder().
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:437)
at com.github.rinde.rinsim.core.model.DependencyResolver.constructDependencyGraph(DependencyResolver.java:90)
at com.github.rinde.rinsim.core.model.DependencyResolver.resolve(DependencyResolver.java:115)
at com.github.rinde.rinsim.core.model.ModelManager$Builder.build(ModelManager.java:268)
at com.github.rinde.rinsim.core.Simulator.<init>(Simulator.java:88)
at com.github.rinde.rinsim.core.Simulator$Builder.build(Simulator.java:347)
at com.github.rinde.rinsim.experiment.Experiment.init(Experiment.java:191)
at com.github.rinde.rinsim.experiment.Experiment.perform(Experiment.java:195)
at com.github.rinde.rinsim.experiment.LocalComputer$ExperimentRunner.call(LocalComputer.java:202)
at com.github.rinde.rinsim.experiment.LocalComputer$ExperimentRunner.call(LocalComputer.java:193)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:258)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:66)
at com.github.rinde.rinsim.experiment.LocalComputer.compute(LocalComputer.java:81)
at com.github.rinde.rinsim.experiment.Experiment$Builder.perform(Experiment.java:684)
at com.github.rinde.rinsim.experiment.Experiment$Builder.perform(Experiment.java:703)
at agv.ExperimentExample.main(ExperimentExample.java:197)
This error indicates that there is a renderer attached to the simulator that expects a model of type CollisionGraphRoadModel. A renderer can only function correctly if there is a corresponding model that contains the data that needs to be rendered.
In AgvExample the following code (see lines 86-90) is used to add the required model:
.addModel(
RoadModelBuilders.dynamicGraph(GraphCreator.createSimpleGraph())
.withCollisionAvoidance()
.withDistanceUnit(SI.METER)
.withVehicleLength(VEHICLE_LENGTH))
You can add similar code if you want to use the WarehouseRenderer in your code.

Am I using TextLoader wrong when running the ML.Net Iris demo in F#?

I am new to F#/.NET and I am trying to run the F# example provided in the accepted answer of How to translate the intro ML.Net demo to F#? with the ML.NET library, using F# on Visual Studio, using Microsoft.ML (0.2.0).
When building it I get the error error FS0039: The type 'TextLoader' is not defined.
To avoid this, I added the line
open Microsoft.ML.Data
to the source.
Then, however, the line
pipeline.Add(new TextLoader<IrisData>(dataPath,separator = ","))
triggers:
error FS0033: The non-generic type 'Microsoft.ML.Data.TextLoader' does not expect any type arguments, but here is given 1 type argument(s)
Changing to:
pipeline.Add(new TextLoader(dataPath,separator = ","))
yields:
error FS0495: The object constructor 'TextLoader' has no argument or settable return property 'separator'. The required signature is TextLoader(filePath: string) : TextLoader.
Changing to:
pipeline.Add(new TextLoader(dataPath))
makes the build successful, but the code fails when running with
ArgumentOutOfRangeException: Column #1 not found in the dataset (it only has 1 columns), I assume because the comma separator is not correctly picked up (incidentally, you can find and inspect the iris dataset at https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data).
Also
pipeline.Add(new TextLoader(dataPath).CreateFrom<IrisData>(separator: ','))
won't work.
I understand that there have been changes in TextLoader recently (see e.g. https://github.com/dotnet/machinelearning/issues/332), can somebody point me to what I am doing wrong?
F# just has a bit of a different syntax that can take some getting used to. It doesn't use the new keyword to instantiate a new class and to use named parameters it uses the = instead of : that you would in C#.
So for this line in C#:
pipeline.Add(new TextLoader(dataPath).CreateFrom<IrisData>(separator: ','))
It would be this in F#:
pipeline.Add(TextLoader(dataPath).CreateFrom<IrisData>(separator=','))

Xcode 6.1 - struct instances console error

I'm a beginner in programming world and I choose "Swift" to be my first programming language. Everything so far went great but now I'm learning about structures and instances, how to update them and so on and I'm getting mysterious console error and I can not move further with my project.
So problem.
I created struct called "Tiger.swift". There is properties for that struct such as name, age, etc. In "viewController" I created new variable called myTiger and tried to update it properties and after my created println command in console appears something strange. It compiles and tells me that "build was succesfully" but in console appears something like this.
"My Tiger's name is: Tigger, it's age is 3, it's age is 3 and it's image is Optional()"
And this strange thing is "Optional". Because if I later want to update my instances it does not compiles and shows me :
"My Tiger's name is: Tigger, it's age is 3, it's age is 3 and it's image is Optional()
fatal error: unexpectedly found nil while unwrapping an Optional value
(lldb) "
There is a link to Git repository ( https://github.com/llinards/lionsandtigers ) in case there isn't a quick solution or a little bug which accidentally I have made.
I would appreciate any help from you!
Thanks!
I took a closer look at your code:
I changed the image property of your Tiger struct to be optional because you don't have a template or placeholder image (if you have one you can set the initial value to that image).
Your storyboard (including your IBOutlets) very pretty screwed up ... I don't know how that happened, I have never seen anything like this before ...
I uploaded a working copy of you project here (It's hard to show that IB-related stuff here, I just deleted and re-added your labels and views).
The relevant code changes I did are the following:
In your Tiger model object (Tiger.swift) I changed the last line from
var image = UIImage(named:"")
to
var image: UIImage?
The first error you encountered was because UUImage(named:"") returns nil. In Swift a non-optional type must never ever be nil.
In your ViewController a changed the Tiger-initializtion to
Tiger(age: 3, name: "Tigger", breed: "TOne", image: UIImage(named: "t1.jpg"))
Your println() call shows:
My Tiger's name is: Tigger, it's age is 3, it's age is 3 and it's image is Optional(UIImage: 0x7f8d78f43c90)
This is correct since your image is now wrapped into an optional.

Resources