auto increment with nested the serial number when row increases and automatically readjust the numbering order when a row gets deleted in angularjs - angularjs-directive

1 will be section and under section there are child like 1.1 subsection and under subsection there will be paragraph...
one section will have multiple subsection like
1
1.1
(a)
(i)
(ii)
-----
1.2
(i)
(ii)
1.3
1
1.1
(a)
(i)
(ii)
(iii)
(iv)
(b)
(i)
(ii)
(iii)
(iv)
2
2.1
(a)
(i)
(ii)
(iii)
(iv)
(b)
(i)
(ii)
(iii)
(iv)
how to do this using angularjs

Related

how to define observation and action space for an array like input

I am working on a problem and I want to implement it as a reinforcement learning problem and integrate it into OpenAI gym. My states are in the form of lists of length n which each element is chosen from a discrete interval [0, m].
for example for n=6 and m=3, this is a sample from the observation space:
[0 2 1 3 3 2]
and the possible accessible states from this space is a set of other lists which are achieved by changing a number of k elements the elements in the list with a number from the same [0, m].
for example, for k=1 we can have the following states as two subsequent states of the previous state:
[0 2 2 3 3 2]
or
[0 3 1 3 3 2]
My question is that what is an efficient way to represent the "actions" in the OpenAI gym for such a scenario?
One way that come to my mind is to just use the next state as the action itself, for example, if I write:
action = env.action_space.sample()
the action would be the next state (which also implicitly contains the action) and then in the env.step(action) make the state equal to the next state.
Does anyone know a better way or using the implicit action representation with the next state is the optimal way?
Does anyone know a predefined gym environment that also has the same representation?
what are the cons of the implicit representation of the actions that I just explained?

How to use esttab to create columns with different cells

Suppose that I have this data:
sysuse auto2, clear
For two different samples, I can use the community-contributed command esttab to create a table of means a and b with standard deviations in parentheses below the means:
eststo clear
eststo a: estpost summarize trunk weight length turn
keep if inrange(mpg, 12, 20)
eststo b: estpost summarize trunk weight length turn
esttab a b, label cells("mean(fmt(2))" "sd(fmt(2) par)") ///
nonumbers booktabs collabels("a" "b")
I want the produced table to have the two columns above exactly as is, but then to add additional summary statistics (here min and max) corresponding to the b estimates.
For example, I want the third column to be like:
esttab b, label cells("min") ///
nonumbers booktabs collabels("min")
In addition, I would like the fourth column to be as follows:
esttab b, label cells("max") ///
nonumbers booktabs collabels("min")
The problem is that I am not sure how to make all of this be in one table together (other than perhaps saving everything to a matrix and using esttab on that).
The reason is that it does not seem like one can get the cells option to correspond to an individual column; it applies the changes to all columns.
Note that if there is a way to do this, but it would require the s.d.s to not be included, that is fine.
How can I generate the desired output without creating a matrix?
This is the best you can do without creating a matrix:
esttab a b, label cells( (mean(fmt(2)) min max) sd(fmt(2) par) )
--------------------------------------------------------------------------------------------------
(1) (2)
mean/sd min max mean/sd min max
--------------------------------------------------------------------------------------------------
Trunk space (.. ft.) 13.76 5.00 23.00 16.32 7.00 23.00
(4.28) (3.28)
Weight (lbs.) 3019.46 1760.00 4840.00 3558.68 2410.00 4840.00
(777.19) (498.89)
Length (in.) 187.93 142.00 233.00 203.89 173.00 233.00
(22.27) (13.87)
Turn Circle (ft.) 39.65 31.00 51.00 42.55 36.00 51.00
(4.40) (3.21)
--------------------------------------------------------------------------------------------------
Observations 74 38
--------------------------------------------------------------------------------------------------

include random slope in binomial mixed model

I am using a binomial GLMM to examine the relationship between presence of individuals (# hours/day) at a site over time. Since presence is measured daily for several individuals, I've included a random intercept for individual ID.
e.g.,
presence <- cbind(hours, 24-hours)
glmer(presence ~ time + (1 | ID), family = binomial)
I'd like to also look at using ID as a random slope, but I don't know how to add this to my model. I've tried the two different approaches below, but I'm not sure which is correct.
glmer(presence ~ time + (1 + ID), family = binomial)
Error: No random effects terms specified in formula
glmer(presence ~ time + (1 + ID | ID), family = binomial)
Error: number of observations (=1639) < number of random effects (=5476) for term (1 + ID | ID); the random-effects parameters are probably unidentifiable
You cannot have a random slope for ID and have ID as a (level-two) grouping variable (see this documentation for more detail: https://cran.r-project.org/web/packages/lme4/lme4.pdf).
The grouping variable, which is ID in the models below, is used as a variable for which to specify random effects. model_1 gives random intercepts for the ID variable. model_2 gives both random intercepts and random slopes for the time variable. In other words, model_1 allows the intercept of the relationship between presence and time to vary with ID(the slope remains the same), whereas model_2 allows for the both the intercept and slopes to vary with ID, so that the relationship between presence and time (i.e., the slope) can be different for each individual (ID).
model_1 = glmer(presence ~ time + (1 | ID), family = binomial)
model_2 = glmer(presence ~ time + (1 + time | ID), family = binomial)
I would also recommend:
Snijders, T. A. B., & Bosker, R. J. (2012). Multilevel analysis: an introduction to basic and advanced multilevel modeling (2nd ed.): Sage.

How to Create a Custom or Unique Neighborhood in NetLogo

In my project, I need to create a unique neighborhood governed by a rule. The default NL neighborhoods do not suit my purpose.
My rule is as follows. Form a neighborhood of three patches as follows:
a. Begin at the origin on the bottom left corner.
b. Assign all patches a label in the form: Patch ”n” where “n” is any random number.
c. Move in a clock wise direction
d. Moving clockwise, select three patches such that they all border each other i.e. Patch 1 has a border with Patches 2 & 3, Patch 2 has a border with Patches 1 & 3 and patch 3 has borders with Patch 1 & 2.
e. If there is more than one possible choice to form the group, select the patch where
n” in the patch label is smallest.
f. If for example I have a world of 100 patches with n=3, then this results in33 neighborhoods of three patches each and a 34th neighborhood of one patch.

How to work with this turing machine?

This is a screenshot of the applet LogiCell 1.0, link to which I found here.
As the bottom left corner shows, this is doing sum 0+1 and the result is 01b (bottom right hand side).
I am not able to link what is displayed to what the inputs ans outputs are. For example in this case - seeing the snapshot, how do you determine that the inputs are 0 and 1 and the output is 01?
From the documentation:
An eater manages the output. The red displayed cell only is activated if an eater absorbs a glider. This cell is the output.
Yet do note that this is a transient situation you have to be measuring for, with a certain periodicity. If you keep running the automata after that square is set, the eater is designed to return to its original form. From the PDF:
To design efficient circuits we need to somehow stop a stream of gliders to prevent the gliders from "polluting" the computational space. There are compact stable patterns, called eaters that consume gliders and then recovery back to their original form.
Since we have two bits of output (MSB and LSB) I've highlighted their "eaters"/outputs:
The addition is defined according to boolean operations:
A B | A+B
---------
0 0 | 0 0
1 0 | 0 1
0 1 | 0 1
1 1 | 1 0
MSB = A and B
LSB = (A or B) and (not (A and B))
It makes sense that you'd be able to compute the MSB faster than the LSB, hence it can be gathered "earlier" (closer to the top of the screen). Just watch the simulation and see that when the bits should be one, the corresponding eater consumes a glider - when they should be zero, the glider streams are stopped before they can reach the eater.
As for how to set up the inputs, it really comes down to whether a single square is on or off in the input construction. You can see this yourself by clicking an input (say A) and then OK, and then clicking it again: