最近我发现了Keras和TensorFlow,我正试图进入ML.我手动将来自用户DB的列车和测试数据分类如下:
9个功能和标签,功能是我的系统中的事件,如"用户添加了个人资料图片"或"用户付费X服务",标签是正或负ROI(1或0)
样品:
我使用以下代码对用户进行了分类:
import numpy as np from keras.layers import Dense from keras.models import Sequential train_data = np.loadtxt("train.csv", delimiter=",", skiprows=1) test_data = np.loadtxt("test.csv", delimiter=",", skiprows=1) X_train = train_data[:, 0:9] Y_train = train_data[:, 9] X_test = test_data[:, 0:9] Y_test = test_data[:, 9] model = Sequential() model.add(Dense(8, input_dim=9, activation='relu')) model.add(Dense(6, activation='relu')) model.add(Dense(3, activation='relu')) model.add(Dense(1, activation='sigmoid')) # Compile model model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) # Fit the model model.fit(X_train, Y_train, epochs=12000, batch_size=10) # evaluate the model scores = model.evaluate(X_test, Y_test) print("\n\n\nResults: %s: %.2f%%" % (model.metrics_names[1], scores[1]*100))
并获得89%的准确率.这很有用,可以将用户标记为有价值的客户.
问:如何提取为可能的投资回报率做出贡献的功能,以便提升他们对用户体验的关注度?
或者:找到最佳组合观众群的方法是什么?