Alternative approaches to Iframes for content distribution via json api

I am currently working on a project that uses iframes to distribute content to customers. Going ahead we would like to switch to a json based rest api to deliver the content. Api access would need a token to which specific content could be exposed and traffic limits set.

To replace the frontend appearance of the iframe I am thinking about writing a reusable bundle using a lightweight react alternative like preactjs. But this would mean exposing the raw api and the specific token to the end user. Simply routing user requests via the customers server would conceal the token but still allow raw api access to the enduser.

What would be a good architecture for such a use case?

Are there server side rendered solutions that can easily be implemented across a variety of backend frameworks, without rewriting everything for each customer that is?

Thanks for any advice

Median of distribution with memory constraint


Task

I want to approximate the median of a given distribution $ D$ that I can sample from.

A simple algorithm for this, using $ n$ samples, is:

samples = [D.sample() for i in range(n)] # generate n samples from D sort(samples) return samples[n/2] 

However, I am looking for an algorithm that requires less than $ O(n)$ space.

Ideas

I have looked into these algorithms:

  • Median of medians: Needs $ O(n)$ space, so it does not work for me.
  • Randomized median: It seems like this could be easily generalized to an algorithm that uses $ O(n^{3/4})$ space.

Are there any other algorithms that use less then $ O(n)$ space that could solve my problem? In particular, I was thinking there may be an algorithm that uses $ O(m)$ space by generating batches of samples from $ D$ of size $ m$

Details

  • Ideally, I am looking for a reference to an algorithm that also includes analysis (success probability, expected runtime, etc).
  • Actually, I need an algorithm to estimate $ D$ ‘s $ p$ -th percentile for a given $ p$ , but I am hoping most median-finding algorithms can be generalized to that.

Gaussian distribution with condition?


What does this expression mean?

Normal distribution with condition

I am reading a research paper and found the following expression (Eq.28 in the paper below).

enter image description here

It means a Gaussian distribution, but the mean component seems conditional probability-like expression $ \it{\bf{s}}_t | \it{\bf{m}}_{b, t, m}^{(j)}$ . I have never seen this expression before and cannot find any info about it.

The variables $ \it{\bf{s}}_t$ and $ \it{\bf{m}}_{b, t, m}^{(j)}$ are both vectors and $ \bf{\Sigma}_{b}$ is a covariance matrix.

Does anybody have an idea of what this expression means?

Original paper where the expression is.

The original paper can be found here: https://eprints.soton.ac.uk/437941/1/08340823.pdf

Thanks in advance.

Distribution of resources from providers to maximum number of receivers

Consider there is a city with $ n$ residents who are in need of internet and there are $ m$ internet providers in the city. Here in the city every resident needs internet and every resident knows what providers are available to him. Formally let resident $ i$ has list of providers $ a_i$ . Also each provider has a maximum number of connections he can give, that is, provider $ i$ can have at max $ k_i$ connections. Find the optimal way of providing internet so that the number of residents having internet is maximum.

My thoughts on the question is that this question looks like a derivative of knack-pack problem with constraints, which suggests dynamic programing but i am unable to find the states. Could anyone help me?

How to calculate probability of values under Weibull distribution?

I have a Genomic data that shows the interaction between genomic regions that I would like to understand which interactions are significant statistically.

Dataset look likes:

chr  start1   end1   start2   end2   normalized count  1     500    1000   2000     3000       1.5  1     500    1000   4500     5000       3.2  1     2500   3500   1000     2000       4 

So, I selected a random number of data (as background) and fitted the normalized frequency into the Weibull distribution using fitdistrplus R packages and estimated some parameters like scale and shape for those sets of data (PD = fitdist(data$ normalized count,'weibull')).

Now I would like to calculate the probability of each observation (like a p-value for each data point) under the fitted Weibull distribution.

But I do not know how can I do that, Can I calculate the Mean of distribution then calculated Z-statistic for each observation and convert it to the p-value?

for example:

The random background that fitted to Weibull using the below parameters:

scale:0.12 shape:023 Mean: 20 Var:12 

How can I calculate the probability of sets of data like (1.2,2.3,4.5,5.0,6.1)?

Asymmetric Transition Probability Matrix with uniform stationary distribution

I am solving a discrete Markov chain problem. For this I need a Markov chain whose stationary distribution is uniform(or near to uniform distribution) and transition probability matrix is asymmetric.

[ Markov chains like Metropolis hasting has uniform stationary distribution but transition probability matrix is symmetric ]