randint(low=4, high=12) returns a number lower than 4 - machine-learning

I am using using Hyperopt's randint in one of my hyperparameter tuning experiments, where my model is getting hyperparamter values from fmin that are lower than than the lower limit specified for randint,
I am passing the following parameters to the hp.randint function (label, low=4, high=12) and the value I got was 0
my env is setup as follows:
hyperopt==0.2.7
numpy==1.19.4
transformers==2.11.0
torch==1.10.2
Any ideas/pointers on how this can be resolved?
Thanks in advance!

Correct signature for this function is hp.randint(label[, low], upper).
Try it without kwargs, only with usual args.

Related

Calculated metrics: create metrics expression

I want to create Calculated metrics expression for same Logical expression for example by Java
if (KPI<=95 & FailedCount!=0) {
STATUS=1;}
else {STATUS=0;}
In Site Scope I wrote this expression
((<<KPI>><=95)&(<<FailedCount>>!=0))
But I do not like the result
When KPI=0 and FailedCount=0;
STATUS=0,
then KPI=100 and FailedCount=0
STATUS='n/a'.
How to reslove this problem?
p.s.
Add question on HP Community too
There's a ternary operator you can use:
(Boolean Expression)? resultIfExpressionIsTrue: resultIfExpressionIsFalse
In your case you could try to use something like:
((<<KPI>><=95)&(<<FailedCount>>!=0))? 1: 0
You may also need to consider if you want the result to be 0 and 1 as integers (as above) or as strings in which case they should be put in between " marks. This is important from the perspective if you'd like to apply arithmetic or string like thresholds to the resulting calculated metric, also if you'd like the result to be seen as numeric or string values in other places, like in OMi or Service Health etc.

How to create a dummy variable

I'm working in a project that uses the IBM SPSS but I had some problems to set a dummy variable(binary variable).The process to get the variable is following : Consider an any variable(width for example), to get the dummy variable, we need
to sort this variable in the decreasing way; The next step is make a somatory of the cases until a limit, the cases before the limit receive the value 1 in the dummy variable the other values receive 0.
Your explanation is rather vague. And the critical value you give in the printscreen should be 2.009 in stead of 20.09?
But I think you mean the following.
When using syntax, use:
compute newdummyvariable eq (ABr gt 2.009477106).
To check if it's okay:
fre newdummyvariable.
UPDATE:
In order to compute a dummy based on the cumulative sum, the answer is as follows:
If your critical value is predetermined, the fastest way is to sort in decending order, and to use the command create with csum() to compute an extra variable which I called ABr_cumul. This one, you use to compute the newdummyvariable. As follows:
sort cases by ABr (d).
create ABr_cumul = csum(VAR00001).
compute newdummyvariable = (ABr_cumul le 20.094771061766488).
fre newdummyvariable.
the dummy comes from the sum of all cases, after decreasing order raqueados when cases of a variable representing 50% of the variable t0tal, these cases receive 1 and the other 0 ...

Torch 7 - parameters questions

I am confused when I see this line in torch 7 demos;
if x ~= parameters then
parameters:copy(x)
end
for example in this documentation at line 147;
https://github.com/torch/tutorials/blob/master/2_supervised/4_train.lua
Does anyone know what this is trying to do in the context of the training process? Thanks.
The x is the parameter of feval(x), and feval is called in optimMethod (e.g. optim.sgd). This means that optimMethod will call the feval function with updated parameters (x). This if statement you mention, will update the parameters of the model with the parameters sent from optimMethod. The statement parameters:copy(x) means copy from x.
if table parameters has not the same address as table x, then do parameters:copy(x)

Mark all negative values of all variables as missing in SPSS

How can I mark all negative values of all variables as missing in SPSS? I have a dataset of more then 300 variables but none of the have missing values defined, but for all of them -1 and -2 should be treated as missing values. Is there a better way than to do it by hand for every variable?
If you really mean all values <= -1 and all variables, you can use a missing range, like this:
missing values all (lo thru -1).
Simplest way is
mis val v1 to v399 ((-2),(-1)).

Syntax for counting cases

I work with SPSS and have difficulty finding/generating a syntax for counting cases.
I have about 120 cases and five variables. I need to know the count /proportion of cases where just one, more than one, or all of the cases have a value of 1 (dichotomous variable). Then I need to compute a new variable that shows the number / proportion of cases which include all of the aforementioned cases (also dichotomous).
For example case number one: var1=1, var2=1, var3=1, var4=0, var5=0 --> newvariable=1.
Case number two: var1=0, var2=0, var3=0, var4=0, var5=0 --> newvariable=1.
And so on...
Can anybody help me with a syntax?
Help would much appreciated!
Here we can use the sum of the variables to determine your conditions. So using a scratch variable that is the sum, we can see if it is equal to 1, more than 1 or 5 in your example.
compute #sum = SUM(var1 to var5).
compute just_one = (#sum = 1).
compute more_one = (#sum > 1).
compute all_one = (#sum = 5).
Similarly, all_one could be computed using the ANY command to evaluate if any zeroes exist, i.e. compute all_one = ANY(0,var1 to var5).. These code snippets assume that var1 to var5 are contiguous in the data frame, if not they just need to be replaced with var1,var2,var3,var4,var5 in all given instances.
You could read up on the logical function ANY in the Command Syntax Reference manual, if you negated a test for ANY with "0", then that is effectively a test for all "1"s. Use of the COUNT command would be another approach.

Resources