`data[i, "γ (N/m)"] ~ Normal(γ_pred, σ)` disallowed in Turing.jl in v0.42? how to fix?

a Turing.jl breaking changes question:
I updated ↑ Turing v0.41.1 ⇒ v0.42.8, then my code broke.

is data[i, "γ (N/m)"] ~ Normal(γ_pred, σ) disallowed now? see code and error below.

I looked for breaking changes in 0.42.0 release here but didn’t see a breaking change regarding this.

many years ago, I learned from the Bayesian ODE tutorial here and it changed to a vectorized statement data[:, i] ~ arraydist(Poisson.(q .* predicted[i] .+ ϵ)) but I tried a similar expression, and the error remains!

the code

@model function cmc_model(data::DataFrame)
	# surface tension of pure water
	@assert data[1, "[S] (mol/m³)"] == 0.0
	γ₀_obs = data[1, "γ (N/m)"]
		
	#=
	prior distributions
	=#
	γ₀ ~ Normal(γ₀_obs, σ)    # N/m
	a ~ Uniform(0.001, 0.1)   # N/m
	K ~ Uniform(0.0, 10000.0) # (mol/m³)⁻¹
	if surfactant == "OTG"
		c★ ~ Uniform(0.0, 30.0)  # mol / m³
	elseif surfactant == "Triton-X-100"
		c★ ~ LogUniform(0.001, 10.0)  # mol / m³
	end
	
	#=
	show data
	=#
	for i = 2:nrow(data)
		# surfactant concentration
		cᵢ = data[i, "[S] (mol/m³)"]
		
		# predicted surface tension
		γ_pred = γ_model(cᵢ, γ₀, a, K, c★)
		
		data[i, "γ (N/m)"] ~ Normal(γ_pred, σ)
	end
	
	return nothing
end

the error

MethodError: no method matching possible(::typeof(BangBang._setindex!), ::DataFrames.DataFrame, ::Float64, ::Int64, ::String)
The function `possible` exists, but no method is defined for this combination of argument types.

Hello! It’s possible that something broke, but I’d need more details to be able to look into it. I can’t run your code since I don’t have the DataFrame input. In the absence of that, a full stack trace would probably be the minimum needed to debug this since the error is not in Turing.jl but rather BangBang.jl so I’d need to see that in order to know how & where this is getting called. If you can copy paste the full error here that would be very helpful.

If you submit an issue on Turing.jl we also ask for the full output of ] st--manifest. That would also help us identify if it’s a sub-dependency because Turing directly & indirectly depends on a lot of libraries.

1 Like

thank you, Penelope!

I posted an issue on Github as you suggested.

1 Like