bitcoin_sentiment
所属分类:加密货币
开发工具:Jupyter Notebook
文件大小:49KB
下载次数:0
上传日期:2022-12-01 20:22:09
上 传 者:
sh-1993
说明: Flask ML应用程序预测比特币新闻的情绪
(Flask-ML application to predict the sentiment of Bitcoin news)
文件列表:
.pre-commit-config.yaml (541, 2022-11-29)
Dockerfile (403, 2022-11-29)
app.png (34188, 2022-11-29)
app.py (1536, 2022-11-29)
data (0, 2022-11-29)
data\raw (0, 2022-11-29)
libs-dev.txt (103, 2022-11-29)
libs.txt (46, 2022-11-29)
model (0, 2022-11-29)
notebooks (0, 2022-11-29)
notebooks\model.ipynb (70051, 2022-11-29)
params.yaml (365, 2022-11-29)
requirements-dev.txt (1959, 2022-11-29)
requirements.txt (303, 2022-11-29)
src (0, 2022-11-29)
src\__init__.py (0, 2022-11-29)
src\models (0, 2022-11-29)
src\models\__init__.py (0, 2022-11-29)
src\models\base_model.py (5056, 2022-11-29)
src\models\utils.py (470, 2022-11-29)
templates (0, 2022-11-29)
templates\index.html (2173, 2022-11-29)
tox.ini (70, 2022-11-29)
# Bitcoin news sentiment
Flask-ML application to predict the sentiment of Bitcoin news using tf-idf and
logistic regression
## Project artifacts:
------------
1. You can find all the necessary artifacts here: [Link](https://drive.google.com/drive/folders/1VLEOCD0heLWvYuIo4nzVevtZXoaQuSG_?usp=share_link)
2. app.py designed to be capable of recreating model .pkl if 'model/' is empty
3. if 'data/raw' is empty, you'll give an error message with instructions
## Model reproducibility params:
------------
model_input:
- rnd_seed: 21
- test_size: 0.20
- regularization_strength: 0.01
- class_weight: "balanced"
vectorizer_input:
- max_features: 4000
- ngram_range: [1,2]
NOTE: you can change model params using 'params.yaml'
## Modelling pipeline:
------------
1. src/models/base_model.py
OR
2. notebooks/model.ipynb
## Local model deployment (two alternative ways):
------------
### I. Using virtual environment:
0. Using this option, be aware that application work was tested only on
Ubuntu 20.04.4 LTS, ***-bit
1. Install Python 3.8.5 using pyenv (Python version management):
$ pyenv install 3.8.5
2. Create local virtual environment using pyenv (Python version management) and
pyenv-virtualenv (virtual environment management):
$ pyenv virtualenv 3.8.5
3. Unzip the repo locally and open a terminal in the repo's directory
4. Activate the pyenv virtual environment in the project's diroctory:
$ pyenv local
5. If you work in repository through VS Code, you usually have additionally
to activate virtual environment for repo using:
Shift + Ctrl + P -> Python: Select Interpreteur ->
choose your environment and run a terminal for the following instructions
6. To be sure that you use a relevant virtual environment use:
$ pyenv version
or
$ pyenv versions
7. Install all the necessary deployment libraries and dependencies using:
$ pip install -r requirements.txt
8. To check the list of the dependencies installed to the virtual environment use:
$ pip list
9. Run the application from the repo directory using:
$ python app.py
10. You can check the application work in your browser running:
http://127.0.0.1:5000
11. To stop the application use Ctrl+C in your terminal
12. If you don't have pyenv as a version management, use following instructions: [Link](https://realpython.com/intro-to-pyenv/#installing-pyenv)
13. If you don't have pyenv-virtualenv as a virtual environment management, use
following insturctions: [Link1](https://github.com/pyenv/pyenv-virtualenv), [Link2](https://realpython.com/intro-to-pyenv/#virtual-environments-and-pyenv)
### II. Using Docker (recommended option):
1. Unzip the repo locally and open a terminal in the repo's directory
2. (optionally) Inslall Docker if you don't have it: [Link](https://docs.docker.com/engine/install/)
3. Run the following in a terminal to build a Docker image:
$ docker build -t bitcoin_sentiment .
4. Run the following in a terminal to run an application in a Docker container:
$ docker run --rm -it -p 5000:5000 bitcoin_sentiment
5. You can check the application work in your browser running:
http://127.0.0.1:5000
6. To stop the application use Ctrl+C in your terminal
------------
### Finally, you'll have to see this:
![app](app.png)
## Project Organization
------------
├── README.md <- The top-level README with the deployment instuctions
|
├── data
│ └── raw <- The original, immutable data dump.
│
├── model <- Trained and serialized models, model predictions, or model summaries
│
├── notebooks <- Jupyter notebooks. Naming convention is a number (for ordering),
│ the creator's initials, and a short `-` delimited description, e.g.
│ `1.0-jqp-initial-data-exploration`.
│
├── references <- Data dictionaries, manuals, and all other explanatory materials.
│
├── templates <- A folder for .html templates
|
├── params.yaml <- Model params and artifacts paths
|
├── libs.txt <- A list of installed libraries (deployment)
│
├── libs-dev.txt <- A list of installed libraries (dev)
|
├── requirements.txt <- The deployment requirements file for reproducing the analysis environment, e.g.
│ generated with `pip freeze > requirements.txt`
|
├── requirements-dev.txt <- The requirements file for reproducing the project (dev)
|
├── Dockerfile <- A script with instructions to build the project Docker image
|
├── app.py <- Flask application script
|
├── src <- Source code for use in this project.
│ ├── __init__.py <- Makes src a Python module
│ │
│ └── models <- Scripts to train models and then use trained models to make
│ │ predictions
│ ├── predict_model.py
│ └── train_model.py
|
├── .pre-commit-config.yaml <- A script that automatically activates linters and formatters before each commit
|
└── tox.ini <- tox file with settings for running tox; see tox.readthedocs.io
近期下载者:
相关文件:
收藏者: