惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
IT之家
IT之家
V
Visual Studio Blog
The Cloudflare Blog
博客园 - 司徒正美
Jina AI
Jina AI
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
S
SegmentFault 最新的问题
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
罗磊的独立博客
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
爱范儿
爱范儿
博客园 - Franky
Last Week in AI
Last Week in AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

TensorFlow

容器化部署没有限制使用 CPU 和内存大小 ollama 只能调动一半 CPU 怎么解决 「提示词微调」「TIG-3.6 Mirage」TIG-3.6-Mirage 技术白皮书:提示微调新范式的工程实现与产业价值 想在 N5015 小主机上部署一个 Tensorflow 的项目,没想到这个 CPU 不支持 AVX 指令集 有没有搞图形算法的兄弟,有个活儿 tensorflow 20 种语言文档只有简中文档过时,也不提示用户过时 关于 tensorflow 引用 PixelLib 图像分割库的问题 你們是去哪找數據 去訓練 deep learning tensorflow 的? 有没有一个合适的开源管理系统,可以管理 tensorflow 的 多机多卡的训练 Tensorflow 1.x 版本如何对 Tensorflow hub 的模型进行微调? 用 Serverless 架构提供 TensorFlow AI 推理函数 请教为何在虚拟机 VirualBox 中运行的 Ubuntu20,没法加载 tensorflow。 我用了 tensorflow 循环从数据中提取命名实体,内存一直累计不释放 请问 tensorflow2 安装最低的内存要求? 想自己训练 tensorflow 识别某个网站验证码的模型,谁能发一个言简意赅的教程,会 Python Tensorflow 有没有入门书籍推荐 在 debian 中用 docker 版本的 tensorflow-gpu 失效问题 图像风格迁移问题,求助 普通的 Linux 服务器怎么跑 tensorflow? 西安 TensorFlow 活动 自然语言处理,分词问题 有没适合企业内部用的开源 AI 平台?自建一个 ai 平台作为进入 ai 领域的研发,要怎么入手? 请教下, 特征有多个值, 怎么处理比较好? Tensorflow 入门教程 关于 spyder3 的 Python 代码运行结果不一致 现在是不是转 MXNET 的最好时机 对于 TensorFlow 2.0 的 Keras API, 大家怎么看 [Tensorboard 问题] 在已添加 tf.summary.scalar()的情况下, tf.summary.merge_all() 返回为 None. 请问这种情况为何发生,如何解决? 安装 tensorflow 的 gpu 版后 import 报错,有大佬碰到过这种情况吗? tensorflow 安装报错 请教: 同一份 Tensorflow 代码,训练新闻自动分类, Windows 和 Linux 下的训练结果不一致?
word2vec+LSTM 情感识别,帮忙看看哪出了问题
KarlRixon · 2019-02-24 · via TensorFlow

数据来源是京东新款手机的评论和打分,目前收集到 2500 条数据,但打分小于 5 分的只有不到 40 条

训练模型层次是:嵌入层-》 LSTM-》 Dense-》 Dense-》输出层 嵌入层的初始数据为 word2vec 训练的词向量 输入的训练数据为词索引,标记为打分

部分代码如下:

def main():
    x_train = pad_seq()
    y_train = star()
    x_train, y_train, x_test, y_test = set_data(x_train, y_train)
    model = Sequential()
    model.add(Embedding(input_dim=input_dim+1, output_dim=output_dim, input_length=k, embeddings_initializer=my_init))
    model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2, activation='sigmoid'))
    model.add(Dense(256, activation='relu'))
    model.add(Dense(128, activation='relu'))
    model.add(Dense(1,activation='sigmoid'))
    model.compile(loss="binary_crossentropy", optimizer="adam", metrics=["accuracy"])
    model.fit(x_train, y_train, batch_size=batch_size, epochs=15)
    score, acc = model.evaluate(x_test, y_test, batch_size=batch_size)
    print('Test score:', score)
    print('Test accuracy:', acc)

然而训练结果是这样的。。。

Epoch 15/15

  32/2015 [..............................] - ETA: 0s - loss: -63.2713 - acc: 0.0000e+00
 160/2015 [=>............................] - ETA: 0s - loss: -63.4706 - acc: 0.0000e+00
 288/2015 [===>..........................] - ETA: 0s - loss: -63.5481 - acc: 0.0000e+00
 384/2015 [====>.........................] - ETA: 0s - loss: -63.2713 - acc: 0.0026    
 480/2015 [======>.......................] - ETA: 0s - loss: -63.3046 - acc: 0.0021
 608/2015 [========>.....................] - ETA: 0s - loss: -63.4024 - acc: 0.0016
 736/2015 [=========>....................] - ETA: 0s - loss: -63.3796 - acc: 0.0027
 864/2015 [===========>..................] - ETA: 0s - loss: -63.3821 - acc: 0.0023
 992/2015 [=============>................] - ETA: 0s - loss: -63.3838 - acc: 0.0020
1120/2015 [===============>..............] - ETA: 0s - loss: -63.3852 - acc: 0.0018
1248/2015 [=================>............] - ETA: 0s - loss: -63.3991 - acc: 0.0016
1376/2015 [===================>..........] - ETA: 0s - loss: -63.4104 - acc: 0.0015
1504/2015 [=====================>........] - ETA: 0s - loss: -63.3879 - acc: 0.0020
1632/2015 [=======================>......] - ETA: 0s - loss: -63.4081 - acc: 0.0018
1760/2015 [=========================>....] - ETA: 0s - loss: -63.4344 - acc: 0.0017
1888/2015 [===========================>..] - ETA: 0s - loss: -63.4233 - acc: 0.0021
2015/2015 [==============================] - 1s 470us/step - loss: -63.4214 - acc: 0.0020

 32/504 [>.............................] - ETA: 2s
504/504 [==============================] - 0s 412us/step
Test score: -63.769539061046785
Test accuracy: 0.0

Process finished with exit code 0

model 如下:

_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
embedding_1 (Embedding)      (None, 20, 50)            49350     
_________________________________________________________________
lstm_1 (LSTM)                (None, 128)               91648     
_________________________________________________________________
dense_1 (Dense)              (None, 256)               33024     
_________________________________________________________________
dense_2 (Dense)              (None, 128)               32896     
_________________________________________________________________
dense_3 (Dense)              (None, 1)                 129       
=================================================================
Total params: 207,047
Trainable params: 207,047
Non-trainable params: 0
_________________________________________________________________