楼主: ReneeBK
1516 8

[Jupyter]Python Social Media Analytics [推广有奖]

  • 1关注
  • 62粉丝

VIP

已卖:4896份资源

学术权威

14%

还不是VIP/贵宾

-

TA的文库  其他...

R资源总汇

Panel Data Analysis

Experimental Design

威望
1
论坛币
49634 个
通用积分
55.5065
学术水平
370 点
热心指数
273 点
信用等级
335 点
经验
57805 点
帖子
4005
精华
21
在线时间
582 小时
注册时间
2005-5-8
最后登录
2023-11-26

楼主
ReneeBK 发表于 2017-8-13 06:39:53 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
Python Social Media Analytics

本帖隐藏的内容

https://github.com/PacktPublishing/Python-Social-Media-Analytics



This is the code repository for Python Social Media Analytics, published by Packt. It contains all the supporting project files necessary to work through the book from start to finish.

About the Book

Social Media platforms such as Facebook, Twitter, Forums, Pinterest, and YouTube have become part of everyday life in a big way. However, these complex and noisy data streams pose a potent challenge to everyone when it comes to harnessing them properly and benefiting from them. This book will introduce you to the concept of social media analytics, and how you can leverage its capabilities to empower your business.

Right from acquiring data from various social networking sources such as Twitter, Facebook, YouTube, Pinterest, and social forums, you will see how to clean data and make it ready for analytical operations using various Python APIs. This book explains how to structure the clean data obtained and store in MongoDB using PyMongo. You will also perform web scraping and visualize data using Scrappy and Beautifulsoup.

Finally, you will be introduced to different techniques to perform analytics at scale for your social data on the cloud, using Python and Spark. By the end of this book, you will be able to utilize the power of Python to gain valuable insights from social media data and use them to enhance your business processes.

Instructions and Navigation

All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.

The code will look like the following:

{ "cells": [  {   "cell_type": "code",   "execution_count": 36,   "metadata": {    "collapsed": true   },   "outputs": [],   "source": [    "import requests\n",    "\n",    "results = []\n",    "q = \"created:>2017-01-01\"\n",    "\n",    "def search_repo_paging(q):\n",    "    params = {'q' : q, 'sort' : 'forks', 'order': 'desc', 'per_page' : 100}\n",    "    url = 'https://api.github.com/search/repositories'\n",    "\n",    "    while True:\n",    "\n",    "        res = requests.get(url, params = params)\n",    "        result = res.json()\n",    "        results.extend(result['items'])\n",    "        params = {}\n",    "\n",    "        try:\n",    "            url = res.links['next']['url']\n",    "        except:\n",    "            break"   ]  },Related ProductsSuggestions and Feedback

Click here if you have any feedback or suggestions.


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:social media Analytics Analytic python Social

本帖被以下文库推荐

沙发
ReneeBK 发表于 2017-8-13 06:44:03
  1. import tensorflow as tf


  2. def weight_variable(shape):
  3.     initial = tf.truncated_normal(shape, stddev=0.1)
  4.     return tf.Variable(initial)


  5. def bias_variable(shape):
  6.     initial = tf.constant(0.1, shape=shape)
  7.     return tf.Variable(initial)


  8. def conv2d(x, W):
  9.     return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')


  10. def max_pool_2x2(x):
  11.     return tf.nn.max_pool(x, ksize=[1, 2, 2, 1],
  12.                           strides=[1, 2, 2, 1], padding='SAME')


  13. def conv_layer(input, shape):
  14.     W = weight_variable(shape)
  15.     b = bias_variable([shape[3]])
  16.     return tf.nn.relu(conv2d(input, W) + b)


  17. def full_layer(input, size):
  18.     in_size = int(input.get_shape()[1])
  19.     W = weight_variable([in_size, size])
  20.     b = bias_variable([size])
  21.     return tf.matmul(input, W) + b
复制代码

藤椅
ReneeBK 发表于 2017-8-13 06:44:53
  1. from tensorflow.examples.tutorials.mnist import input_data
  2. import tensorflow as tf
  3. import numpy as np

  4. DATA_DIR = '/tmp/data'
  5. MINIBATCH_SIZE = 50
  6. STEPS = 5000

  7. from layers import *

  8. mnist = input_data.read_data_sets(DATA_DIR, one_hot=True)

  9. x = tf.placeholder(tf.float32, shape=[None, 784])
  10. y_ = tf.placeholder(tf.float32, shape=[None, 10])

  11. x_image = tf.reshape(x, [-1, 28, 28, 1])
  12. conv1 = conv_layer(x_image, shape=[5, 5, 1, 32])
  13. conv1_pool = max_pool_2x2(conv1)

  14. conv2 = conv_layer(conv1_pool, shape=[5, 5, 32, 64])
  15. conv2_pool = max_pool_2x2(conv2)

  16. conv2_flat = tf.reshape(conv2_pool, [-1, 7*7*64])
  17. full_1 = tf.nn.relu(full_layer(conv2_flat, 1024))

  18. keep_prob = tf.placeholder(tf.float32)
  19. full1_drop = tf.nn.dropout(full_1, keep_prob=keep_prob)

  20. y_conv = full_layer(full1_drop, 10)

  21. cross_entropy = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=y_conv, labels=y_))
  22. train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)
  23. correct_prediction = tf.equal(tf.argmax(y_conv, 1), tf.argmax(y_, 1))
  24. accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

  25. with tf.Session() as sess:
  26.     sess.run(tf.global_variables_initializer())

  27.     for i in range(STEPS):
  28.         batch = mnist.train.next_batch(MINIBATCH_SIZE)

  29.         if i % 100 == 0:
  30.             train_accuracy = sess.run(accuracy, feed_dict={x: batch[0], y_: batch[1],
  31.                                                            keep_prob: 1.0})
  32.             print("step {}, training accuracy {}".format(i, train_accuracy))

  33.         sess.run(train_step, feed_dict={x: batch[0], y_: batch[1], keep_prob: 0.5})

  34.     X = mnist.test.images.reshape(10, 1000, 784)
  35.     Y = mnist.test.labels.reshape(10, 1000, 10)
  36.     test_accuracy = np.mean([sess.run(accuracy, feed_dict={x:X[i], y_:Y[i], keep_prob:1.0}) for i in range(10)])

  37. print("test accuracy: {}".format(test_accuracy))
复制代码

板凳
hjtoh 发表于 2017-8-13 06:56:43 来自手机
ReneeBK 发表于 2017-8-13 06:39
Python Social Media Analytics**** 本内容被作者隐藏 ****

This is the code repository for Python So ...
谢谢分享
已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

报纸
MouJack007 发表于 2017-8-13 07:35:25
谢谢楼主分享!
已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

地板
MouJack007 发表于 2017-8-13 07:35:41

7
军旗飞扬 发表于 2017-8-13 07:45:13
谢谢楼主分享!
已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

8
nonewman 发表于 2017-8-13 08:04:47
running ahead
已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

9
cszcszcsz 发表于 2017-8-13 16:40:35
谢谢分享!
已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-6 06:46