This project predicts whether an applicant will be hired for a job based on their experience, education and skill level.
- Synthetic dataset stored in a PostgreSQL database, managed with SQLAlchemy ORM.
- Logistic Regression model trained to predict hiring outcomes.
- RESTful API build with FastAPI; ongoing improvements to enhance RESTful compliance.
- Frontend development in progress.
Step 1: Clone the repo
Step 2: Install and start PostgreSQL
brew install postgresql
brew services start postgresqlStep 3: Create a virtual environment (in project folder) and install dependencies in it
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtStep 4: Connect to PostgreSQL
psql -d postgresOR
psql -U your_computer_username -d postgresStep 5: Create database and user in PostgreSQL
CREATE DATABASE mydatabase;
CREATE USER myuser WITH PASSWORD 'mypassword';
GRANT ALL PRIVILEGES ON DATABASE mydatabase TO myuser;Step 6: Connect to mydatabase using myuser and create applicants table
psql -U myuser -d mydatabase CREATE TABLE applicants (
id SERIAL PRIMARY KEY,
years_experience INT,
education_level VARCHAR(50),
has_relevant_skills BOOLEAN,
hired BOOLEAN
)Step 7: Create an .env file containing database credentials (to connect to DB in database.py)
DB_USER=myuser
DB_PASSWORD=mypassword
DB_HOST=localhost
DB_PORT=5432
DB_NAME=mydatabaseTo generate data: num_iters is a postive number, defaults to 100 when nothing is provided
python data/generate_data.py generate num_itersTo delete data:
python data/generate_data.py deleteTo train model:
python logistic_regression/train_model.pyTo run API:
uvicorn api.main_api:app --reloadTo update requirements.txt:
pip install some_package # manually installed
pip freeze > requirements.txt # update fileTo disconnect psql:
\qDo not remove content from .gitignore!!!