How to fix remove NAs from my regression table and fix error message when running expert summs - error-handling

I am trying to export a table or a regression analysis summary. using the export_summs function keeps returning the error message: Error in [<-(*tmp*, , names(coef(fm)), value = coef(fm)) :
subscript out of bounds
Note that this issue did not happen with the exact same data before. I just ran it again with more efficient and statistically better model. everything else is the same. I have tried changing the coefficient names in several ways and omitting the missing values. summary() is not an issue. only when I try running export_summs(). another issue is that I have used na.action=na.omit in the regression formula and na.omit("regression formula") and NA still shows up as a value in my regression table.
How do I fix those two issues?
Appreciate the help.

Related

CreateML data analysis stopped

When I attempt to train a CreateML model, I get the following screen after inputting my training data:
Create ML error message
I am then unable to add my test data or train the model. Any ideas on what is going on here?
[EDIT] As mentioned in my comment below, this issue went away when I removed some of my training data. Any newcomers who are running into this issue are encouraged to try some of the solutions below and comment on whether it worked for them. I'm happy to accept an answer if it seems like it's working for people.
This happens when the first picture in the dataset has no label. If you place a labeled photo as the first in the dataset and in the coreML json, you shouldn't get that issue.
Correct:
[{"annotations":[{"label":"Enemy","coordinates":{"y":156,"x":302,"width":26,"height":55}}],"imagefilename":"Enemy1.png"},{"annotations":[{"label":"Enemy","coordinates":{"y":213,"x":300,"width":69,"height":171}}],"imagefilename":"Enemy7.png"},{"annotations":
Incorrect:
[{"annotations":[],"imagefilename":"Enemy_v40.png"},{"annotations":[],"imagefilename":"Enemy_v41.png"},{"annotations":[],"imagefilename":"Enemy_v42.png"},{"annotations":
At the minimum you should check for these 2 situations, which triggered the same generic error for me (data analysis stopped), in the context of an Object Detection Model:
One or more of the image names referenced in annotations.json is incorrect (e.g. typo in image name)
The first entry in annotations.json has an empty annotations array (i.e. an image that does not contain any of the objects to be detected)
If you are using any random Split or something similar, make sure, its parsing the data correctly. you can test this easily by debugging.
I suggest you check to see if your training data is consistent and all entries have all needed values. The error is likely in the section of data you removed.
That would cause the error Nate commented he is seeing when he gets that pop up.
Getting the log would be the next step in any other evaluation.

Octave: quadprog index issue?

I am trying to run several files of code for an assignment. I am trying to solve an optimization problem using the "quadprog" function from the "optim" package.
quadprog is supposed to solve the optimization problem in a certain format and takes inputs H,f, A,b, Aeq, Beq, lb, ub.
The issue I am having involves my f which is a column vector of constants. To clarify, f looks like c*[1,1,1,1,1,1] where c is a constant. Quadprog seems to run my code just fine for certain values of c, but gives me the error:
error: index (_,49): but object has size 2x2
error: called from
quadprog at line 351 column 32
for other values of c. So, for example, 1/3 works, but 1/2 doesn't. Does anyone have any experience with this?
Sorry for not providing a working example. My code runs over several files and I seem to only be having problems with a specific value set that is very big. Thanks!
You should try the qp native Octave function.
You mention f is: c*[1,1,1,1,1,1] but, if c is a scalar, that is not a column vector. It seems very odd that a scalar value might produce a dimensions error...

SSIS : Excel Source detection type

i'm currently working
in sql server 2012,
and OLEDB JET provider 12.0.
excel 13.
i have to import many excel files ... but this bloody provider doesn't detect the rigth type in a very wierd and strange way, meaning ==>
i know for the rowtypeguess that scans the 8 first lines to determine the type(but i can't change the register to change that property in all the servers) .
and the big problem is that ssis detects some float columns as dt-wstr because they have the first eigth at null but for others he detects the right type : float !
i don't understand why there is an invariant behavior !!!
i have even tried to force the excel columns to numbers but still SSIS want them to be DT_WSTR.
so i'm forced to do a tmp table and then convert all the columns that need to be float like this :
case
when isnull([cola],'') <> ''
then cast(replace([cola],',','.') as float)
end
the problem is that i have countless columns and i have to do this integration prety frenquently : so it means that if the next time these columns are suddenly recognized as floats but other are no longer recognized as floats
i have to change every thing at every integration.
how can i manage that for the long run ? have you some kind of explanations?
Okay, so like i said in my question,
i have even tried to force the excel columns to numbers like following
and today restarting my computer, i noticed he was detecting them as floats !!!! hallelouiahhhhhhhh
during the afternoon they went back to wstr ... harsh life i get i will have to force everything to wstr and thennnnn convert them one by one ...for countless cols ....
i'm wondering what's the point with ssis ... ? it's not practical at all !!!

#NLConstraint with vectorized constraint JuMP/Julia

I am trying to solve a problem involving the equating of sums of exponentials.
This is how I would do it hardcoded:
#NLconstraint(m, exp(x[25])==exp(x[14])+exp(x[18]))
This works fine with the rest of the code. However, when I try to do it for an arbitrary set of equations like the above I get an error. Here's my code:
#NLconstraint(m,[k=1:length(LHSSum)],sum(exp.(LHSSum[k][i]) for i=1:length(LHSSum[k]))==sum(exp.(RHSSum[k][i]) for i=1:length(RHSSum[k])))
where LHSSum and RHSSum are arrays containing arrays of the elements that need to be exponentiated and then summed over. That is LHSSum[1]=[x[1],x[2],x[3],...,x[n]]. Where x[i] are variables of type JuMP.Variable. Note that length(LHSSum)=length(RHSSum).
The error returned is:
LoadError: exp is not defined for type Variable. Are you trying to build a nonlinear problem? Make sure you use #NLconstraint/#NLobjective.
So a simple solution would be to simply do all the exponentiating and summing outside of the #NLconstraint function, so the input would be a scalar. However, this too presents a problem since exp(x) is not defined since x is of type JuMP.variable, whereas exp expects something of type real. This is strange since I am able to calculate exponentials just fine when the function is called within an #NLconstraint(). I.e. when I code this line#NLconstraint(m,exp(x)==exp(z)+exp(y)) instead of the earlier line, no errors are thrown.
Another thing I thought to do would be a Taylor Series expansion, but this too presents a problem since it goes into #NLconstraint land for powers greater than 2, and then I get stuck with the same vectorization problem.
So I feel stuck, I feel like if JuMP would allow for the vectorized evaluation of #NLconstraint like it does for #constraint, this would not even be an issue. Another fix would be if JuMP implements it's own exp function to allow for the exponentiation of JuMP.Variable type. However, as it is I don't see a way to solve this problem in general using the JuMP framework. Do any of you have any solutions to this problem? Any clever workarounds that I am missing?
I'm confused why i isn't used in the expressions you wrote. Do you mean:
#NLconstraint(m, [k = 1:length(LHSSum)],
sum(exp(LHSSum[k][i]) for i in 1:length(LHSSum[k]))
==
sum(exp(RHSSum[k][i]) for i in 1:length(RHSSum[k])))

local variable referenced before assignment frequently occurring error

Hello I've done multiple python programs since I started and an error is occurring quite often for a short time and I don't understand why there is an error or why by just changing random things so the program does the same gets rid of it so can anybody please explain how the "referenced before assignment" error occurs please.
Here's the code with the problem:
def compter(sequence, element):
comtpe=0
for i in sequence:
if element==sequence[i]:
compte+=1
return compte
compter([1,2,1,1], 1)
please explain so I could be able to get rid of it in any future code thank you very much :)
(I'musing python 2.7.6)