base) nijpadariya@nijs-MacBook-Air httpstan-4.12.0 % python3 -m pip install dist/*.whl
ERROR: httpstan-4.12.0-cp311-cp311-macosx_14_0_arm64.whl is not a supported wheel on this platform.
Python 3.11.7
conda 24.1.2
macOs sonoma 14.5
base) nijpadariya@nijs-MacBook-Air httpstan-4.12.0 % python3 -m pip install dist/*.whl
ERROR: httpstan-4.12.0-cp311-cp311-macosx_14_0_arm64.whl is not a supported wheel on this platform.
Python 3.11.7
conda 24.1.2
macOs sonoma 14.5
there’s another interface for Python users: CmdStanPy
for the new MacBook chips - M1, etc, the condo install might also be problematic; installation via pip works just fine: Installation — CmdStanPy 1.2.2 documentation
example notebooks here: CmdStanPy Examples — CmdStanPy 1.2.2 documentation
schools_code = “”"
data {
int<lower=0> J; // number of schools
array[J] real y; // estimated treatment effects
array[J] real<lower=0> sigma; // standard error of effect estimates
}
parameters {
real mu; // population treatment effect
real<lower=0> tau; // standard deviation in treatment effects
vector[J] eta; // unscaled deviation from mu by school
}
transformed parameters {
vector[J] theta = mu + tau * eta; // school treatment effects
}
model {
target += normal_lpdf(eta | 0, 1); // prior log-density
target += normal_lpdf(y | theta, sigma); // log-likelihood
}
“”"
schools_data = {“J”: 8,
“y”: [28, 8, -3, 7, -1, 1, 18, 12],
“sigma”: [15, 10, 16, 11, 9, 11, 10, 18]}
posterior = stan.build(schools_code, data=schools_data)
fit = posterior.sample(num_chains=4, num_samples=1000)
eta = fit[“eta”] # array with shape (8, 4000)
df = fit.to_frame() # pandas `DataFrame, requires pandas
what change do in this code to run in mac m1