CLG.setCoef
- CLG.setCoef(val1, val2, coef)
Set the coefficient of an arc val1->val2.
- Parameters:
val1 (
int | str) – The name or the int of the parent variable.val2 (
int | str) – The name or the int of the child variable.coef (
floatorint) – The new coefficient of the arc.
- Raises:
pyagrum.NotFound – if one of the names is not found in the CLG.
ValueError – if the coefficient is 0.
ValueError – if the arc does not exist.
- Return type:
None
Example
import pyagrum.clg as gclg
clg = gclg.SEM.toclg("""
A = 2[1]
B = 1 + 0.5A[2]
C = 3 + B[1]
""")
clg.setCoef("A", "B", 2.5)
clg.coefArc("A", "B")
# 2.5
Class