You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raiseValueError("This dataset does not have a basis to update. Please use `add_basis` to create and initialize the values in the Dataset's basis matrix.")
62
+
raiseValueError(
63
+
"This dataset does not have a basis to update. Please use `add_basis` to create and initialize the values in the Dataset's basis matrix."
Whether to exponentiate the variance weights before storing them in the dataset.
108
116
"""
109
117
ifnotself.has_variance_weights():
110
-
raiseValueError("This dataset does not have variance weights to update. Please use `add_variance_weights` to create and initialize the values in the Dataset's variance weight vector.")
118
+
raiseValueError(
119
+
"This dataset does not have variance weights to update. Please use `add_variance_weights` to create and initialize the values in the Dataset's variance weight vector."
120
+
)
111
121
ifnotisinstance(variance_weights, np.ndarray):
112
122
raiseValueError("variance_weights must be a numpy array.")
113
123
variance_weights_=np.squeeze(variance_weights)
114
124
n=variance_weights_.size
115
125
ifvariance_weights_.ndim!=1:
116
126
raiseValueError("variance_weights must be a 1-dimensional numpy array.")
117
127
ifself.num_observations() !=n:
118
-
raiseValueError(f"The number of rows in the new variance_weights vector ({n}) must match the number of rows in the existing vector ({self.num_observations()}).")
128
+
raiseValueError(
129
+
f"The number of rows in the new variance_weights vector ({n}) must match the number of rows in the existing vector ({self.num_observations()})."
130
+
)
119
131
self.dataset_cpp.UpdateVarianceWeights(variance_weights_, n, exponentiate)
120
132
121
133
defnum_observations(self) ->int:
@@ -150,7 +162,7 @@ def num_basis(self) -> int:
150
162
Dimension of the basis vector in the dataset, returning 0 if the dataset does not have a basis
151
163
"""
152
164
returnself.dataset_cpp.NumBasis()
153
-
165
+
154
166
defget_covariates(self) ->np.array:
155
167
"""
156
168
Return the covariates in a Dataset as a numpy array
Add a constant value to every leaf of every tree in an ensemble. If leaves are multi-dimensional, `constant_value` will be added to every dimension of the leaves.
Value that will be added to every leaf of every tree
1052
1081
"""
1053
1082
self.forest_cpp.AddConstant(constant_value)
1054
-
1083
+
1055
1084
defmultiply_constant(self, constant_multiple):
1056
1085
"""
1057
1086
Multiply every leaf of every tree by a constant value. If leaves are multi-dimensional, `constant_multiple` will be multiplied through every dimension of the leaves.
0 commit comments