microsoft/qlib · error · ValueError
not implemented yet
Error message
not implemented yet
What it means
Thrown by DEnsembleModel.get_loss when self.loss is not "mse". Double Ensemble's sample-reweighting and feature-selection modules need per-sample training loss; only mean squared error is implemented, so any other loss string (e.g. "mae", a LightGBM objective name) is rejected during fit.
Source
Thrown at qlib/contrib/model/double_ensemble.py:225
g["g_value"].replace(np.nan, 0, inplace=True)
# divide features into bins_fs bins
g["bins"] = pd.cut(g["g_value"], self.bins_fs)
# randomly sample features from bins to construct the new features
res_feat = []
sorted_bins = sorted(g["bins"].unique(), reverse=True)
for i_b, b in enumerate(sorted_bins):
b_feat = features[g["bins"] == b]
num_feat = int(np.ceil(self.sample_ratios[i_b] * len(b_feat)))
res_feat = res_feat + np.random.choice(b_feat, size=num_feat, replace=False).tolist()
return pd.Index(set(res_feat))
def get_loss(self, label, pred):
if self.loss == "mse":
return (label - pred) ** 2
else:
raise ValueError("not implemented yet")
def retrieve_loss_curve(self, model, df_train, features):
if self.base_model == "gbm":
num_trees = model.num_trees()
x_train, y_train = df_train["feature"].loc[:, features], df_train["label"]
# Lightgbm need 1D array as its label
if y_train.values.ndim == 2 and y_train.values.shape[1] == 1:
y_train = np.squeeze(y_train.values)
else:
raise ValueError("LightGBM doesn't support multi-label training")
N = x_train.shape[0]
loss_curve = pd.DataFrame(np.zeros((N, num_trees)))
pred_tree = np.zeros(N, dtype=float)
for i_tree in range(num_trees):
pred_tree += model.predict(x_train.values, start_iteration=i_tree, num_iteration=1)
loss_curve.iloc[:, i_tree] = self.get_loss(y_train, pred_tree)
else:View on GitHub (pinned to 79633dd950)
Solutions
- Use loss="mse" (the supported value)
- For classification-style tasks, encode the target appropriately and keep mse, or pick a different model class
Example fix
# before model = DEnsembleModel(loss="mae") # after model = DEnsembleModel(loss="mse")
Defensive patterns
Strategy: validation
Validate before calling
assert loss == "mse", "DEnsembleModel supports only loss='mse' (needed for sample reweighting and feature selection)"
Prevention
- Do not treat DEnsembleModel's loss as a free LightGBM objective string
- Keep loss='mse' when using Double Ensemble workflows
When it happens
Trigger: Constructing DEnsembleModel(loss="mae") or loss="binary" etc.; loss is forwarded into params as the objective, but the reweighting math only knows "mse".
Common situations: Treating loss as a free LightGBM objective parameter; porting a classification objective into Double Ensemble.
Related errors
- nfs-common is not found, please install it by execute: sudo
- Mount failed: requires sudo or permission denied
- mount {provider_uri} on {mount_path} error! Command error
- Mount failed: {e.stderr}
- We can't find the project path
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/1f0368bed047b793.
Report an issue: GitHub.