Click to show TOC
This is a slightly more elaborate example
This is a simple code example to create a javascript array and display it.
 What just happened, if you execute the code above it will display the array just created.
Note: the last expression array
is displayed.
let
only exists in the snipped
This is one more example in a new page. The is it my test.
This is a example of optimization useful in certain modeling of estimating the cost of service for medical conditions. One simple model for a service, for example heart contition, is as follows:
Cost = Base * comp1 * comp2 * comp3
, where comp1, comp2 percentage increase on the base cost.
b. This can also be written in exponential form Cost = exp( b + c1 + c2 + c3 )
where b = ln(Base)
, and c1 = ln(comp1)
…
expL
take the exponent of the elements of an arrayrect
acts like a rectifier in electronic circuit if val is negetive return 0, otherwise return the value, clamp
id similar, returns 0 for negetive values and 1 for positive caluesmax
returns the max value of a liststdPdiv
get standard deviation uning only the poisitve values of an array range
Create a array with elemenst [0, 1, 2, … n-1]zip
Takes 2 lists (list1, list2) and returns a new array with length of list1, where element i
is a 2 element array [ list1[i], list2[i] ]Object to model the cost of treatment, this has the following attributes
real
the actual cost of treatmentfactorFlag
this is an array of 1 or 0 for each of the cost factors 1 = factor present for the patient, 0 = factor not presentreal
holds the real cost. Since we do not actually have real data we will create some simulated data,
a. All patients have the base factor b
codes[0]
b. The other factors have arelative probability of occuring, code[1] has (100-70) = 30% chance, codes[2] has (100-90)= 10% chance and so on, this is allocodea using fillFactor()
function. current
best estimate of cost prediction based on the factors estimates
   
 
This is a more optimized risk factor calculator usin the log(e(x)) = log(Total) property. This linearizes the problem.
   This section we will show how the multiplicative concept of optimization can be used compute the gradient descent algorithm