【问题标题】:How to insert my messages as input in my feature columns in SVM estimator in the Tensorflow package如何将我的消息作为输入插入到 Tensorflow 包的 SVM 估计器的特征列中
【发布时间】:2019-12-26 06:40:20
【问题描述】:

我正在尝试实现我的文本分类模型,该模型使用 SVM 模型在 Tensorflow 中将消息分类为垃圾邮件或非垃圾邮件。 我只有 2 个特征,即联系人姓名和消息,我需要将它们转换为数字还是可以直接用作特征列中的输入

svm = tf.contrib.learn.SVM(
    example_id_column=example_id_column_name,
    feature_columns=(tf.contrib.layers.real_valued_column(
        column_name=x_column_name, dimension=90),),
    l2_regularization=0.1)

svm.fit(input_fn=train_input_fn, steps=10)

【问题讨论】:

    标签: tensorflow machine-learning svm text-classification


    【解决方案1】:

    它会报错吗?如果它给出类似这样的错误:“无法将字符串转换为浮点数”,那么您将无法使用它。如果它有效,那么你可以使用它。

    在文档中还解释了您需要什么: https://www.tensorflow.org/api_docs/python/tf/contrib/learn/SVM

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-09
      • 1970-01-01
      • 2018-07-24
      • 1970-01-01
      • 2017-09-15
      • 2015-10-30
      • 1970-01-01
      • 2018-11-11
      相关资源
      最近更新 更多