Implementation of modeling the data which has the property of group structure by pyro

I have one question the implementation of modeling by Pyro.

I am analyzing the failure analysis of our company’s product that machine is used for semiconductor manufacturing process.This product has saved the sensor value that measure internal state of this product daily. So this data’s structure is the table that the column are consist of many sensor value(feature) and state of the our products (target value that becomes binary state “Normal” or “Failure”) linked to measured date. we the five machine’s data.I plan to use the logistic regression and evaluate the weight value that is multiplied to each sensor value in linear predictor of p_i .

but this sample(feature and target value) is affected by the individual differences of each product. So to model this individual differences, I plan to add group structure term rg[gn[i]] to linear predictor. I assume rg[gn[i]] is random variable that is engaged to N(0,s^2[i]). Value of s^2[gn] is changed by the products of sample_i measured. So in this case, we have the five machine data, so The variable of s^2[gn] is five values.

How to implement this group structure regarding rg[gn[i]]and s^2[gn]? I plan to estimate fixed effect(α,β) and random effect parameter(s^2[gn])by MCMC .Attached picture is the formula I plan to calucate.