In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Python how to predict the number of official account fans, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Recently, the number of official account fans has been on the rise, of course, as a progressive (fish) official account blogger, of course, to pursue more ambitious goals. I hope to know how many fans will be on the official account in a month, so as to strengthen the publicity of the official account.
As it happens, Facebook has opened up a model called prophet, which can predict time series data based on the additive model, and its nonlinear trend coincides with the seasonality and holiday effects of the year, week and day. It is also robust to changes in lost data and trends, and usually handles outliers well.
We will use the trend of the last 60 days of the Python practical treasure book to predict the amount of attention in the next 30 days.
1. Install fbprophet
Now, let's have a try! The first is to install fbprophet, the premise here is that everyone has installed Python, if not, it is recommended to read: Python hyperdetailed installation guide, if you follow the official tutorial, use pip to install, you will find that TM does not install anything
.
As a first step, we need to install fbprophet's dependent PyStan:
Pip install pystan
The second step is to use the conda command to install (if you need to install anaconda, search the anaconda official website for installation):
Conda install-c conda-forge fbprophet2. Export official account data
This is the time to use F12, right-click in the blank space of the current user analysis page-check, or press F12 directly to open the developer tool.
Then select the data of the last two months, find the useranalysis packet, click and find the data we need. Save this piece of json data as a data.json file, as shown in the following figure.
3. Processing data
Load json data:
Now you need to extract the date and its corresponding total number of fans into a pandas dataframe. If you have not already installed pandas, please type pip install pandas in cmd/Terminal to install successfully.
Effect:
You can see that dataframe is a bit like a collection of dictionaries and lists. As long as you remember the shape of this data structure, today's tutorial will not be too complicated.
4. Forecast data for the next 30 days
Next, you need to generate a prophet object and call the prediction function to predict the data changes in the next 30 days:
Effect:
Let's take a look at the effect. Yhat in the table refers to the average value of the forecast, yhat_lower is the minimum value of the forecast, and yhat_upper is the maximum value of the forecast. According to the Prophet, our number of fans will increase to 529 in the next 30 days, which means an increase of 16%. In fact, the value of this prediction is relatively objective, and we will know whether the prediction is accurate or not in a month.
After reading the above, have you mastered Python's method of predicting the number of official account fans? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.