1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-17 09:24:34 +08:00

add_pre-commit_and_flake8_to_CI

This commit is contained in:
Linlang Lv (iSoftStone)
2022-03-22 09:48:13 +08:00
committed by you-n-g
parent 243e516cf1
commit 30e457119c
45 changed files with 191 additions and 42 deletions

View File

@@ -249,7 +249,7 @@ class DEnsembleModel(Model, FeatureInt):
return pred
def predict_sub(self, submodel, df_data, features):
x_data, y_data = df_data["feature"].loc[:, features], df_data["label"]
x_data = df_data["feature"].loc[:, features]
pred_sub = pd.Series(submodel.predict(x_data.values), index=x_data.index)
return pred_sub

View File

@@ -84,7 +84,7 @@ class SFM_Model(nn.Module):
if len(self.states) == 0: # hasn't initialized yet
self.init_states(x)
self.get_constants(x)
p_tm1 = self.states[0]
p_tm1 = self.states[0] # noqa: F841
h_tm1 = self.states[1]
S_re_tm1 = self.states[2]
S_im_tm1 = self.states[3]

View File

@@ -477,10 +477,10 @@ class TabNet(nn.Module):
sparse_loss = []
out = torch.zeros(x.size(0), self.n_d).to(x.device)
for step in self.steps:
x_te, l = step(x, x_a, priors)
x_te, loss = step(x, x_a, priors)
out += F.relu(x_te[:, : self.n_d]) # split the feature from feat_transformer
x_a = x_te[:, self.n_d :]
sparse_loss.append(l)
sparse_loss.append(loss)
return self.fc(out), sum(sparse_loss)