model_name = "WDL"
sample_size = 64
feature_dim_dict = {"sparse": {}, "dense": []}
wide_feature_dim_dict = {"sparse": {}, "dense": []}
for name, num in zip(["sparse", "dense"], [sparse_feature_num, sparse_feature_num]):
if name == "sparse":
for i in range(num):
feature_dim_dict[name][name + "_" +
str(i)] = np.random.randint(1, 10)
else:
for i in range(num):
feature_dim_dict[name].append(name + "_" + str(i))
for name, num in zip(["sparse", "dense"], [wide_feature_num, wide_feature_num]):
if name == "sparse":
for i in range(num):
wide_feature_dim_dict[name][name + "wide_" +
str(i)] = np.random.randint(1, 10)
else:
for i in range(num):
wide_feature_dim_dict[name].append(name + "wide_" + str(i))
sparse_input = [np.random.randint(0, dim, sample_size)
for dim in feature_dim_dict["sparse"].values()]
dense_input = [np.random.random(sample_size)
for name in feature_dim_dict["dense"]]
wide_sparse_input = [np.random.randint(0, dim, sample_size)
for dim in wide_feature_dim_dict["sparse"].values()]
wide_dense_input = [np.random.random(sample_size)
for name in wide_feature_dim_dict["dense"]]
y = np.random.randint(0, 2, sample_size)
After Change
model_name = "WDL"
sample_size = 64
feature_dim_dict = {"sparse": [], "dense": []}
wide_feature_dim_dict = {"sparse": [], "dense": []}
for name, num in zip(["sparse", "dense"], [sparse_feature_num, sparse_feature_num]):
if name == "sparse":
for i in range(num):