第24月第30天 scrapy《TensorFlow机器学习项目实战》项目记录

1.Scrapy

https://www.imooc.com/learn/1017

https://github.com/pythonsite/spider/tree/master/jobboleSpider

xpath

验证xpath也是类似的。语法是$x(“your_xpath_selector”)。注意:语法中括号里需要通过双引号括起来,如果xpath语句中有双引号,要改成单引号,不然只能解析到第一对双引号的内容

https://blog.csdn.net/baixiaozhe/article/details/78189520

https://www.github.com/zhaoxiangyu333/Python-Scrapy/

Use "scrapy" to see available commands

原因:

没有cd到项目根目录,因为crawl会去搜搜cmd目录下的scrapy.cfg

3.tensorflow逻辑回归(mnist)

https://blog.csdn.net/kenwengqie2235/article/details/78535384

3.三个月教你从零入门深度学习

https://github.com/huxiaoman7/learningdl

https://edu.hellobi.com/course/268

4.《TensorFlow机器学习项目实战》代码运行问题

命令

再pycharm建立virtualenv

cd ~/tensorflow2/tensorflow/

source bin/activate

pip install pandas

第3章 例1--单变量线性回归

1报错位置:.tf.scalar_summary(\'batch_loss\', loss)AttributeError: \'module\' object has no attribute \'scalar_summary\'修改为:tf.summary.scalar(\'batch_loss\', loss)原因:新版本做了调整

2.AttributeError: \'module\' object has no attribute \'histogram_summary\'修改为:tf.summary.histogram

3.tf.merge_all_summaries()改为:summary_op = tf.summaries.merge_all()

4.AttributeError: \'module\' object has no attribute \'SummaryWriter\':tf.train.SummaryWriter改为tf.summary.FileWriter

https://blog.csdn.net/lijjianqing/article/details/70155905?utm_source=copy

multiply

第6章 例1--MNIST数字分类

修改为

# Define loss and optimizer

cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=pred, labels=Y))

第7章 例2--创作巴赫风格的曲目

https://github.com/sherjilozair/char-rnn-tensorflow

def lstm_cell():
    if \'reuse\' in inspect.signature(tf.contrib.rnn.BasicLSTMCell.__init__).parameters:
        return tf.contrib.rnn.BasicLSTMCell(size, forget_bias=0.0,
                                     state_is_tuple=True, 
                                     reuse=tf.get_variable_scope().reuse)
    else:
        return tf.contrib.rnn.BasicLSTMCell(
                                     size, forget_bias=0.0, state_is_tuple=True)

  https://stackoverflow.com/questions/43060827/valueerror-attempt-to-have-a-second-rnncell-use-the-weights-of-a-variable-scope

第8章 例子--VGG艺术风格转移

https://github.com/anishathalye/neural-style

1

2

3

wget http://www.vlfeat.org/matconvnet/models/beta16/imagenet-vgg-verydeep-19.mat

python neural_style.py --content examples/1-content.jpg --styles examples/1-style.jpg --output examples/myoutput.jpg --network ../neural-style-mat/imagenet-vgg-verydeep-19.mat

  

https://www.cnblogs.com/lijingpeng/p/6009476.html