Commit a2e5ce88 authored by 张彦钊's avatar 张彦钊

change transform

parent d74c6332
......@@ -113,6 +113,7 @@ def get_statistics():
for i in df.columns.difference(["device_id", "os","total"]):
df[i] = df[i]/df["total"]
df = df.drop("total", axis=1)
print(df.dtypes)
df["y"] = 1
model = multiFFMFormatPandas()
df = model.fit_transform(df, y="y", n=100000, processes=18)
......@@ -166,7 +167,7 @@ class multiFFMFormatPandas:
name = '{}_{}'.format(col, val)
if col_type.kind == 'O':
ffm.append('{}:{}:1'.format(self.field_index_[col]+1, self.feature_index_[name]))
elif col_type.kind == 'i':
elif col_type.kind != 'O':
ffm.append('{}:{}:{}'.format(self.field_index_[col]+1, self.feature_index_[col], val))
result = ' '.join(ffm)
if self.y is not None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment