Using support vector machine (SVM) i have created this simple prediction of sales project which uses the linear kernel can be used to predict sales for an organisation. I have picked a random dataset from internet and trained this model
Since i am using python i have used several libraries here:
- pandas
- sklearn
- matplotlib.pyplot
- streamlit
This guide explains how to activate a Python virtual environment and run a Streamlit app on Linux or macOS. Note: These instructions may not work on Windows.
- Python 3.6 or higher installed
- pip (Python package installer)
Open a terminal in your project directory and run:
python3 -m venv prediction
move the svm.py and the .csv file into virtual enviornment folder named "prediction"
cp svm.py ~/path/to/the/predictionfolder
cp sales_data_past_2_years.csv ~/path/to/the/predictionfolder
source prediction/bin/activate
After activation, your terminal prompt should display (prediction)
.
With the virtual environment activated, install Streamlit:
pip install streamlit
Navigate to the directory containing svm.py
and run:
streamlit run svm.py
To stop the app, press CTRL + C in the terminal.
When done, deactivate the virtual environment with:
deactivate
The above instructions are optimized for Linux and macOS. On Windows, commands may differ, and additional setup may be required.
- Command not found: Ensure Python and pip are installed and available in your system's PATH.
- Verify Streamlit installation with
pip list
inside the virtual environment.
the streamlit app now should run on your localhost port 8501