Fake-News-Detection-Python-Project

所属分类:编程语言基础
开发工具:Python
文件大小:0KB
下载次数:0
上传日期:2020-04-05 07:55:40
上 传 者sh-1993
说明:  Python有史以来最好的数据分析项目@假新闻检测您是否信任从社交媒体听到的所有新闻所有新闻都不是真实的,对吗?因此,您将如何检测假新闻答案是Python。通过实践这个检测假新闻的高级python项目,您将很容易区分真实新闻和假新闻。月之前...
(Python Best Ever Project for Data Analysis @ Fake news Detection Do you trust all the news you hear from social media? All news are not real, right? So how will you detect the fake news? The answer is Python. By practicing this advanced python project of detecting fake news, you will easily make a difference between real and fake news. Before)

文件列表:
LICENSE (1070, 2020-04-05)
data_cleaning/ (0, 2020-04-05)
data_cleaning/csv_transform.py (6262, 2020-04-05)
data_cleaning/data_cleaning.ipynb (1776, 2020-04-05)
data_cleaning/get_articles.py (1318, 2020-04-05)
data_scraper/ (0, 2020-04-05)
data_scraper/ParallelScraper.py (4819, 2020-04-05)
data_scraper/scraper.py (2156, 2020-04-05)
environment.yaml (4863, 2020-04-05)
fakenews_finalpaper.pdf (331234, 2020-04-05)
pipeline/ (0, 2020-04-05)
pipeline/model.py (11347, 2020-04-05)
pipeline/model_loop.py (10804, 2020-04-05)
pipeline/pipeline_testing.ipynb (26327, 2020-04-05)
pipeline/run.py (3160, 2020-04-05)
pipeline/run_both.sh (200, 2020-04-05)
pipeline/run_grammar.sh (206, 2020-04-05)
pipeline/transform_features.py (7230, 2020-04-05)

# fake-news-detection Final Project for CAPP 30255 Advanced Machine Learning You can find the final summary for this project in the main directory. ## Dependencies - python 3.x - nltk - numpy - sklearn - scipy - pandas - spacy We have included a conda environment yaml. To install, run: conda env create -f environment.yml ## Data This project is using a [dataset published by Signal Media](http://research.signalmedia.co/newsir16/signal-dataset.html) in conjunction with the Recent Trends in News Information Retrieval 2016 conference to facilitate conducting research on news articles. We use [OpenSources.co](http://opensources.co) to distinguish between 'legitimate' and 'fake' news sources. ## Feature Generation From the raw article text, we generate the following features: 1. Vectorized bigram Term Frequency-Inverse Document Frequency, with preprocessing to strip out named entities (people, places etc.) and replace them with anonymous placeholders (e.g. "Donald Trump" --> "-PERSON-"). We use Spacy for tokenization and entity recognition, and SkLearn for TFIDF vectorization. 2. Normalized frequency of parsed syntacical dependencies. Again, we use Spacy for parsing and SkLearn for vectorization. Here is an [excellent interactive visualization](https://demos.explosion.ai/displacy/) of Spacy's dependency parser. ## Pipeline The pipeline contains four sets of python code: - `model.py`: a class for models - `model_loop.py`: a class for running a loop of classifiers; takes test-train data splits and various run params - `run.py`: this code implements the model_loop class; it also implements our re-sampling of the data - `transform_features.py`: this file executes all feature generation Running the code is done through `run.py` with the following options: 1. `--models`: models to run 2. `--iterations`: number of tuning parameter iterations to run per model 3. `--output_dir`: a directory name to store the output; system will create the directory 4. `--dedupe`: whether to look for and remove duplicate content 5. `--features`: which feature set to run with, options include: - `both_only`: runs both PCFG and TFIDF - `grammar_only`: runs only PCFG - `tfidf_only`: runs only TFIDF - `all`: runs all the above ## Example Pipeline Run To execute the pipeline with Logistic Regression and Stochastic Gradient Descent, navigate to the pipeline directory, run: ``` source activate amlpp python run.py /path/to/data --models LR SGD --iterations 50 --output_dir run_name --dedupe --reduce 500 --features both_only ``` This is encapsulated in the `run.sh` file. The first argument is the path to the input datafile. The pipeline assumes that the text of each article is unique. If your texts are not unique, use the flag --dedupe to automatically remove duplicated articles during preprocessing. To see a description of all arguments, run: ``` python run.py --h ``` A simple report on the models run with basic evaluation metrics will be output to the output/ directory (unless another output directory is specified). ## License MIT License Copyright (c) 2017 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

近期下载者

相关文件


收藏者